diff --git a/src/mame/audio/redalert.c b/src/mame/audio/redalert.c index 9c8ff9ed13b..30300f78599 100644 --- a/src/mame/audio/redalert.c +++ b/src/mame/audio/redalert.c @@ -10,19 +10,24 @@ #include "driver.h" #include "rescap.h" #include "cpu/i8085/i8085.h" +#include "machine/6821pia.h" #include "sound/ay8910.h" #include "sound/hc55516.h" -#define AUDIO_PCB_CLOCK (XTAL_12_5MHz) -#define AUDIO_CPU_CLOCK (AUDIO_PCB_CLOCK / 12) -#define AY8910_CLOCK (AUDIO_PCB_CLOCK / 6) -#define AUDIO_CPU_IRQ_FREQ (1.0 / attotime_to_double(PERIOD_OF_555_ASTABLE(RES_K(120), RES_K(2.7), CAP_U(0.01)))) +#define REDALERT_AUDIO_PCB_CLOCK (XTAL_12_5MHz) +#define REDALERT_AUDIO_CPU_CLOCK (REDALERT_AUDIO_PCB_CLOCK / 12) +#define REDALERT_AY8910_CLOCK (REDALERT_AUDIO_PCB_CLOCK / 6) +#define REDALERT_AUDIO_CPU_IRQ_FREQ (1.0 / attotime_to_double(PERIOD_OF_555_ASTABLE(RES_K(120), RES_K(2.7), CAP_U(0.01)))) -#define VOICE_PCB_CLOCK (XTAL_6MHz) -#define VOICE_CPU_CLOCK (VOICE_PCB_CLOCK) -#define HC55516_CLOCK (VOICE_PCB_CLOCK / 256) +#define REDALERT_VOICE_PCB_CLOCK (XTAL_6MHz) +#define REDALERT_VOICE_CPU_CLOCK (REDALERT_VOICE_PCB_CLOCK) +#define REDALERT_HC55516_CLOCK (REDALERT_VOICE_PCB_CLOCK / 256) + +#define DEMONEYE_AUDIO_PCB_CLOCK (XTAL_3_579545MHz) +#define DEMONEYE_AUDIO_CPU_CLOCK (DEMONEYE_AUDIO_PCB_CLOCK / 4) /* what's the real divisor? */ +#define DEMONEYE_AY8910_CLOCK (DEMONEYE_AUDIO_PCB_CLOCK / 2) /* what's the real divisor? */ @@ -32,14 +37,16 @@ * *************************************/ -static UINT8 audio_register_IC1; -static UINT8 audio_register_IC2; +static UINT8 ay8910_latch_1; +static UINT8 ay8910_latch_2; + +static UINT8 ay8910_latch_1; /************************************* * - * Analog sounds + * Read Alert analog sounds * *************************************/ @@ -61,7 +68,7 @@ static WRITE8_HANDLER( redalert_analog_w ) /************************************* * - * Audio board + * Red Alert audio board * *************************************/ @@ -88,36 +95,36 @@ static WRITE8_HANDLER( redalert_AY8910_w ) /* BC1=1, BDIR=0 : read from PSG */ case 0x01: - audio_register_IC1 = AY8910_read_port_0_r(offset); + ay8910_latch_1 = AY8910_read_port_0_r(0); break; /* BC1=0, BDIR=1 : write to PSG */ case 0x02: - AY8910_write_port_0_w(offset, audio_register_IC2); + AY8910_write_port_0_w(0, ay8910_latch_2); break; /* BC1=1, BDIR=1 : latch address */ default: case 0x03: - AY8910_control_port_0_w(offset, audio_register_IC2); + AY8910_control_port_0_w(0, ay8910_latch_2); break; } } -static READ8_HANDLER( audio_register_IC1_r ) +static READ8_HANDLER( redalert_ay8910_latch_1_r ) { - return audio_register_IC1; + return ay8910_latch_1; } -static WRITE8_HANDLER( audio_register_IC2_w ) +static WRITE8_HANDLER( redalert_ay8910_latch_2_w ) { - audio_register_IC2 = data; + ay8910_latch_2 = data; } -static const struct AY8910interface ay8910_interface = +static const struct AY8910interface redalert_ay8910_interface = { soundlatch_r, 0, /* port A/B read */ 0, redalert_analog_w /* port A/B write */ @@ -128,7 +135,7 @@ static ADDRESS_MAP_START( redalert_audio_map, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(15) ) AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x0c00) AM_RAM AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x0ffe) AM_READWRITE(MRA8_NOP, redalert_AY8910_w) - AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x0ffe) AM_READWRITE(audio_register_IC1_r, audio_register_IC2_w) + AM_RANGE(0x1001, 0x1001) AM_MIRROR(0x0ffe) AM_READWRITE(redalert_ay8910_latch_1_r, redalert_ay8910_latch_2_w) AM_RANGE(0x2000, 0x6fff) AM_NOP AM_RANGE(0x7000, 0x77ff) AM_MIRROR(0x0800) AM_ROM ADDRESS_MAP_END @@ -136,15 +143,15 @@ ADDRESS_MAP_END static SOUND_START( redalert_audio ) { - state_save_register_global(audio_register_IC1); - state_save_register_global(audio_register_IC2); + state_save_register_global(ay8910_latch_1); + state_save_register_global(ay8910_latch_2); } /************************************* * - * Voice board + * Red Alert voice board * *************************************/ @@ -186,7 +193,7 @@ ADDRESS_MAP_END /************************************* * - * Audio start + * Red Alert audio start * *************************************/ @@ -200,29 +207,175 @@ static SOUND_START( redalert ) /************************************* * - * Machine driver + * Red Alert machine driver * *************************************/ MACHINE_DRIVER_START( redalert_audio ) - MDRV_CPU_ADD(M6502, AUDIO_CPU_CLOCK) + MDRV_CPU_ADD(M6502, REDALERT_AUDIO_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(redalert_audio_map,0) - MDRV_CPU_PERIODIC_INT(irq0_line_hold, AUDIO_CPU_IRQ_FREQ) + MDRV_CPU_PERIODIC_INT(irq0_line_hold, REDALERT_AUDIO_CPU_IRQ_FREQ) - MDRV_CPU_ADD(8085A, VOICE_CPU_CLOCK) + MDRV_CPU_ADD(8085A, REDALERT_VOICE_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(redalert_voice_map,0) MDRV_SOUND_START( redalert ) MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD(AY8910, AY8910_CLOCK) - MDRV_SOUND_CONFIG(ay8910_interface) + MDRV_SOUND_ADD(AY8910, REDALERT_AY8910_CLOCK) + MDRV_SOUND_CONFIG(redalert_ay8910_interface) MDRV_SOUND_ROUTE(0, "mono", 0.50) MDRV_SOUND_ROUTE(1, "mono", 0.50) /* channel C is used a noise source and is not connected to a speaker */ - MDRV_SOUND_ADD(HC55516, HC55516_CLOCK) + MDRV_SOUND_ADD(HC55516, REDALERT_HC55516_CLOCK) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) +MACHINE_DRIVER_END + + + +/************************************* + * + * Demoneye-X audio board + * + *************************************/ + + +WRITE8_HANDLER( demoneye_audio_command_w ) +{ + /* the byte is connected to port A of the AY8910 */ + soundlatch_w(0, data); + + cpunum_set_input_line(1, INPUT_LINE_NMI, PULSE_LINE); +} + + +static WRITE8_HANDLER( demoneye_ay8910_latch_1_w ) +{ + ay8910_latch_1 = data; +} + + +static READ8_HANDLER( demoneye_ay8910_latch_2_r ) +{ + return ay8910_latch_2; +} + + +static WRITE8_HANDLER( demoneye_ay8910_data_w ) +{ + switch (ay8910_latch_1 & 0x03) + { + case 0x00: + if (ay8910_latch_1 & 0x10) + AY8910_write_port_0_w(0, data); + + if (ay8910_latch_1 & 0x20) + AY8910_write_port_1_w(0, data); + + break; + + case 0x01: + if (ay8910_latch_1 & 0x10) + ay8910_latch_2 = AY8910_read_port_0_r(0); + + if (ay8910_latch_1 & 0x20) + ay8910_latch_2 = AY8910_read_port_1_r(0); + + break; + + case 0x03: + if (ay8910_latch_1 & 0x10) + AY8910_control_port_0_w(0, data); + + if (ay8910_latch_1 & 0x20) + AY8910_control_port_1_w(0, data); + + break; + + default: + logerror("demoneye_ay8910_data_w called with latch %02X data %02X\n", ay8910_latch_1, data); + break; + } +} + + +static ADDRESS_MAP_START( demoneye_audio_map, ADDRESS_SPACE_PROGRAM, 8 ) + ADDRESS_MAP_FLAGS( AMEF_ABITS(14) ) + AM_RANGE(0x0000, 0x007f) AM_RAM + AM_RANGE(0x0500, 0x0503) AM_READWRITE(pia_0_r, pia_0_w) + AM_RANGE(0x2000, 0x3fff) AM_ROM +ADDRESS_MAP_END + + +static const struct AY8910interface demoneye_ay8910_interface = +{ + soundlatch_r, 0, /* port A/B read */ + 0, 0 /* port A/B write */ +}; + + +static const pia6821_interface demoneye_pia_intf = +{ + /*inputs : A/B,CA/B1,CA/B2 */ demoneye_ay8910_latch_2_r, 0, 0, 0, 0, 0, + /*outputs: A/B,CA/B2 */ demoneye_ay8910_data_w, demoneye_ay8910_latch_1_w, 0, 0, + /*irqs : A/B */ 0, 0 +}; + + + +/************************************* + * + * Demoneye-X audio start + * + *************************************/ + +static SOUND_START( demoneye ) +{ + pia_config(0, &demoneye_pia_intf); + + state_save_register_global(ay8910_latch_1); + state_save_register_global(ay8910_latch_2); +} + + + +/************************************* + * + * Demoneye-X audio reset + * + *************************************/ + +static SOUND_RESET( demoneye ) +{ + pia_reset(); +} + + + +/************************************* + * + * Demoneye-X machine driver + * + *************************************/ + +MACHINE_DRIVER_START( demoneye_audio ) + + MDRV_CPU_ADD(M6802, DEMONEYE_AUDIO_CPU_CLOCK) + MDRV_CPU_PROGRAM_MAP(demoneye_audio_map,0) + MDRV_CPU_PERIODIC_INT(irq0_line_hold, REDALERT_AUDIO_CPU_IRQ_FREQ) /* guess */ + + MDRV_SOUND_START( demoneye ) + MDRV_SOUND_RESET( demoneye ) + + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD(AY8910, DEMONEYE_AY8910_CLOCK) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MDRV_SOUND_ADD(AY8910, DEMONEYE_AY8910_CLOCK) + MDRV_SOUND_CONFIG(demoneye_ay8910_interface) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) MACHINE_DRIVER_END diff --git a/src/mame/drivers/redalert.c b/src/mame/drivers/redalert.c index 5ba5c3d7d8f..7ddd6991eb6 100644 --- a/src/mame/drivers/redalert.c +++ b/src/mame/drivers/redalert.c @@ -52,17 +52,23 @@ ********************************************************************* - Known issues/to-do's: + Known issues/to-do's all games: + * Video timing from schematics + + Known issues/to-do's Red Alert: * Analog sounds * DIP switches have a different meaning in test mode (see manual) - * Video timing from schematics * Audio CPU NMI is generated by a 74121 multivibrator, the correct pulse length is not emulated + Known issues/to-do's Demoneye-X: + * Game is NOT_WORKING due to missing graphics layer + * Everything needs to be verified on real PCB or schematics + ****************************************************************************/ #include "driver.h" -#include "machine/6821pia.h" +#include "cpu/m6502/m6502.h" #include "redalert.h" @@ -71,38 +77,34 @@ -/* PIA 0, sound CPU */ -static const pia6821_interface pia_0_intf = -{ - /*inputs : A/B,CA/B1,CA/B2 */ 0, 0, 0, 0, 0, 0, - /*outputs: A/B,CA/B2 */ 0, 0, 0, 0, - /*irqs : A/B */ 0, 0 -}; - -static MACHINE_START( demoneye ) -{ - pia_config(0, &pia_0_intf); -} - -static MACHINE_RESET( demoneye ) -{ - pia_reset(); -} - - - /************************************* * * Interrupt generation * *************************************/ -static INTERRUPT_GEN( redalert_interrupt ) +static INTERRUPT_GEN( redalert_vblank_interrupt ) { if( readinputport(3) ) + /* the service coin as conntected to the CPU's RDY pin as well */ cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); - cpunum_set_input_line(0, 0, HOLD_LINE); + cpunum_set_input_line(0, M6502_IRQ_LINE, ASSERT_LINE); +} + + +static READ8_HANDLER( redalert_interrupt_clear_r ) +{ + cpunum_set_input_line(0, M6502_IRQ_LINE, CLEAR_LINE); + + /* the result never seems to be actually used */ + return video_screen_get_vpos(0); +} + + +static WRITE8_HANDLER( redalert_interrupt_clear_w ) +{ + redalert_interrupt_clear_r(0); } @@ -118,14 +120,14 @@ static ADDRESS_MAP_START( redalert_main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x2000, 0x3fff) AM_READWRITE(MRA8_RAM, redalert_bitmap_videoram_w) AM_BASE(&redalert_bitmap_videoram) AM_RANGE(0x4000, 0x4fff) AM_RAM AM_BASE(&redalert_charmap_videoram) AM_RANGE(0x5000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READWRITE(input_port_0_r, MWA8_NOP) - AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READWRITE(input_port_1_r, MWA8_NOP) - AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READWRITE(input_port_2_r, MWA8_NOP) + AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READWRITE(port_tag_to_handler8("C000"), MWA8_NOP) + AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READWRITE(port_tag_to_handler8("C010"), MWA8_NOP) + AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READWRITE(port_tag_to_handler8("C020"), MWA8_NOP) AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, redalert_audio_command_w) AM_RANGE(0xc040, 0xc040) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, MWA8_RAM) AM_BASE(&redalert_video_control) AM_RANGE(0xc050, 0xc050) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, MWA8_RAM) AM_BASE(&redalert_bitmap_color) AM_RANGE(0xc060, 0xc060) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, redalert_voice_command_w) - AM_RANGE(0xc070, 0xc070) AM_MIRROR(0x0f8f) AM_READWRITE(watchdog_reset_r, MWA8_NOP) + AM_RANGE(0xc070, 0xc070) AM_MIRROR(0x0f8f) AM_READWRITE(redalert_interrupt_clear_r, redalert_interrupt_clear_w) AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(REGION_CPU1, 0x8000) ADDRESS_MAP_END @@ -133,38 +135,21 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( demoneye_main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_RAM AM_RANGE(0x2000, 0x3fff) AM_READWRITE(MRA8_RAM, redalert_bitmap_videoram_w) AM_BASE(&redalert_bitmap_videoram) - AM_RANGE(0x4000, 0x4fff) AM_RAM AM_BASE(&redalert_charmap_videoram) - AM_RANGE(0x5000, 0x5fff) AM_RAM -// AM_RANGE(0x5000, 0x53ff) AM_WRITE(MWA8_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size) -// AM_RANGE(0x5400, 0x57ff) AM_WRITE(MWA8_RAM) AM_BASE(&redalert_spriteram3) -// AM_RANGE(0x5800, 0x5bff) AM_WRITE(MWA8_RAM) //??? -// AM_RANGE(0x5c00, 0x5fff) AM_WRITE(MWA8_RAM) //??? + AM_RANGE(0x4000, 0x5fff) AM_RAM AM_BASE(&redalert_charmap_videoram) AM_RANGE(0x6000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READWRITE(input_port_0_r, MWA8_NOP) - AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READWRITE(input_port_1_r, MWA8_NOP) - AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READWRITE(input_port_2_r, MWA8_NOP) - AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, MWA8_NOP) + AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x0f8f) AM_READWRITE(port_tag_to_handler8("C000"), MWA8_NOP) + AM_RANGE(0xc010, 0xc010) AM_MIRROR(0x0f8f) AM_READWRITE(port_tag_to_handler8("C010"), MWA8_NOP) + AM_RANGE(0xc020, 0xc020) AM_MIRROR(0x0f8f) AM_READWRITE(port_tag_to_handler8("C020"), MWA8_NOP) + AM_RANGE(0xc030, 0xc030) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, demoneye_audio_command_w) AM_RANGE(0xc040, 0xc040) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, MWA8_RAM) AM_BASE(&redalert_video_control) AM_RANGE(0xc050, 0xc050) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, MWA8_RAM) AM_BASE(&redalert_bitmap_color) - AM_RANGE(0xc060, 0xc060) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, MWA8_NOP) - AM_RANGE(0xc070, 0xc070) AM_MIRROR(0x0f8f) AM_READWRITE(MRA8_NOP, MWA8_NOP) + AM_RANGE(0xc060, 0xc060) AM_MIRROR(0x0f80) AM_READWRITE(MRA8_NOP, MWA8_NOP) /* unknown */ + AM_RANGE(0xc061, 0xc061) AM_MIRROR(0x0f80) AM_READWRITE(MRA8_NOP, MWA8_NOP) /* unknown */ + AM_RANGE(0xc062, 0xc062) AM_MIRROR(0x0f80) AM_READWRITE(MRA8_NOP, MWA8_NOP) /* unknown */ + AM_RANGE(0xc070, 0xc070) AM_MIRROR(0x0f8f) AM_READWRITE(redalert_interrupt_clear_r, redalert_interrupt_clear_w) /* probably not correct */ AM_RANGE(0xf000, 0xffff) AM_ROM AM_REGION(REGION_CPU1, 0x8000) ADDRESS_MAP_END -//static ADDRESS_MAP_START( demoneye_sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) -// AM_RANGE(0x0000, 0x007f) AM_READ(MRA8_RAM) -// AM_RANGE(0x0500, 0x0503) AM_READ(pia_0_r) -// AM_RANGE(0x2000, 0x2fff) AM_READ(MRA8_ROM) -// AM_RANGE(0xf000, 0xffff) AM_READ(MRA8_ROM) -//ADDRESS_MAP_END - -//static ADDRESS_MAP_START( demoneye_sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) -// AM_RANGE(0x0000, 0x007f) AM_WRITE(MWA8_RAM) -// AM_RANGE(0x0500, 0x0503) AM_WRITE(pia_0_w) -// AM_RANGE(0x2000, 0x2fff) AM_WRITE(MWA8_ROM) -// AM_RANGE(0xf000, 0xffff) AM_WRITE(MWA8_ROM) -//ADDRESS_MAP_END - /************************************* @@ -174,7 +159,7 @@ ADDRESS_MAP_END *************************************/ static INPUT_PORTS_START( redalert ) - PORT_START + PORT_START_TAG("C000") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW:1,2") PORT_DIPSETTING( 0x00, "3" ) PORT_DIPSETTING( 0x01, "4" ) @@ -196,33 +181,36 @@ static INPUT_PORTS_START( redalert ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_HIGH, "SW:8" ) - PORT_START /* IN1 */ - PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) - PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) - PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) - PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) - PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) - PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ + PORT_START_TAG("C010") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) /* pin 35 - N.C. */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) /* pin 36 - N.C. */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ - PORT_START /* IN2 */ - PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ - PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT ( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT ( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT ( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL - PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL - PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ + PORT_START_TAG("C020") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) /* pin 33 - N.C. */ + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) /* pin 34 - N.C. */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ - PORT_START /* Fake input for coins */ + PORT_START_TAG("COIN") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1) + PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END static INPUT_PORTS_START( demoneye ) - PORT_START /* DIP Switches */ + PORT_START_TAG("C000") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPSETTING( 0x00, "3" ) PORT_DIPSETTING( 0x01, "4" ) @@ -246,7 +234,7 @@ static INPUT_PORTS_START( demoneye ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_START /* IN1 */ + PORT_START_TAG("C010") PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) @@ -256,7 +244,7 @@ static INPUT_PORTS_START( demoneye ) PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ - PORT_START /* IN2 */ + PORT_START_TAG("C020") PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL @@ -266,8 +254,11 @@ static INPUT_PORTS_START( demoneye ) PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Meter */ - PORT_START /* Fake input for coins */ + PORT_START_TAG("COIN") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1) + PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END @@ -283,7 +274,7 @@ static MACHINE_DRIVER_START( redalert ) /* basic machine hardware */ MDRV_CPU_ADD(M6502, MAIN_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(redalert_main_map,0) - MDRV_CPU_VBLANK_INT(redalert_interrupt,1) + MDRV_CPU_VBLANK_INT(redalert_vblank_interrupt,1) /* video hardware */ MDRV_IMPORT_FROM(redalert_video) @@ -298,13 +289,13 @@ static MACHINE_DRIVER_START( demoneye ) /* basic machine hardware */ MDRV_CPU_ADD(M6502, MAIN_CPU_CLOCK) MDRV_CPU_PROGRAM_MAP(demoneye_main_map,0) - MDRV_CPU_VBLANK_INT(redalert_interrupt,1) - - MDRV_MACHINE_START( demoneye ) - MDRV_MACHINE_RESET( demoneye ) + MDRV_CPU_VBLANK_INT(redalert_vblank_interrupt,1) /* video hardware */ - MDRV_IMPORT_FROM(redalert_video) + MDRV_IMPORT_FROM(demoneye_video) + + /* audio hardware */ + MDRV_IMPORT_FROM(demoneye_audio) MACHINE_DRIVER_END @@ -317,44 +308,46 @@ MACHINE_DRIVER_END ROM_START( redalert ) ROM_REGION( 0x10000, REGION_CPU1, 0 ) - ROM_LOAD( "rag5", 0x5000, 0x1000, CRC(d7c9cdd6) SHA1(5ff5cdceaa00083b745cf5c74b096f7edfadf737) ) - ROM_LOAD( "rag6", 0x6000, 0x1000, CRC(cb2a308c) SHA1(9f3bc22bad31165e080e81d4a3fb0ec2aad235fe) ) - ROM_LOAD( "rag7n", 0x7000, 0x1000, CRC(82ab2dae) SHA1(f8328b048384afac245f1c16a2d0864ffe0b4741) ) - ROM_LOAD( "rag8n", 0x8000, 0x1000, CRC(b80eece9) SHA1(d986449bdb1d94832187c7f953f01330391ef4c9) ) - ROM_LOAD( "rag9", 0x9000, 0x1000, CRC(2b7d1295) SHA1(1498af0c55bd38fe79b91afc38921085102ebbc3) ) - ROM_LOAD( "ragab", 0xa000, 0x1000, CRC(ab99f5ed) SHA1(a93713bb03d61cce64adc89b874b67adea7c53cd) ) - ROM_LOAD( "ragb", 0xb000, 0x1000, CRC(8e0d1661) SHA1(bff4ddca761ddd70113490f50777e62c66813685) ) + ROM_LOAD( "rag5", 0x5000, 0x1000, CRC(d7c9cdd6) SHA1(5ff5cdceaa00083b745cf5c74b096f7edfadf737) ) + ROM_LOAD( "rag6", 0x6000, 0x1000, CRC(cb2a308c) SHA1(9f3bc22bad31165e080e81d4a3fb0ec2aad235fe) ) + ROM_LOAD( "rag7n", 0x7000, 0x1000, CRC(82ab2dae) SHA1(f8328b048384afac245f1c16a2d0864ffe0b4741) ) + ROM_LOAD( "rag8n", 0x8000, 0x1000, CRC(b80eece9) SHA1(d986449bdb1d94832187c7f953f01330391ef4c9) ) + ROM_LOAD( "rag9", 0x9000, 0x1000, CRC(2b7d1295) SHA1(1498af0c55bd38fe79b91afc38921085102ebbc3) ) + ROM_LOAD( "ragab", 0xa000, 0x1000, CRC(ab99f5ed) SHA1(a93713bb03d61cce64adc89b874b67adea7c53cd) ) + ROM_LOAD( "ragb", 0xb000, 0x1000, CRC(8e0d1661) SHA1(bff4ddca761ddd70113490f50777e62c66813685) ) ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "w3s1", 0x7000, 0x0800, CRC(4af956a5) SHA1(25368a40d7ebc60316fd2d78ec4c686e701b96dc) ) + ROM_LOAD( "w3s1", 0x7000, 0x0800, CRC(4af956a5) SHA1(25368a40d7ebc60316fd2d78ec4c686e701b96dc) ) ROM_REGION( 0x10000, REGION_CPU3, 0 ) - ROM_LOAD( "ras1b", 0x0000, 0x1000, CRC(ec690845) SHA1(26a84738bd45ed21dac6c8383ebd9c3b9831024a) ) - ROM_LOAD( "ras2", 0x1000, 0x1000, CRC(fae94cfc) SHA1(2fd798706bb3afda3fb55bc877e597cc4e5d0c15) ) - ROM_LOAD( "ras3", 0x2000, 0x1000, CRC(20d56f3e) SHA1(5c32ee3365407e6d3f7ab5662e9ecbac437ed4cb) ) - ROM_LOAD( "ras4", 0x3000, 0x1000, CRC(130e66db) SHA1(385b8f889fee08fddbb2f75a691af569109eacd1) ) + ROM_LOAD( "ras1b", 0x0000, 0x1000, CRC(ec690845) SHA1(26a84738bd45ed21dac6c8383ebd9c3b9831024a) ) + ROM_LOAD( "ras2", 0x1000, 0x1000, CRC(fae94cfc) SHA1(2fd798706bb3afda3fb55bc877e597cc4e5d0c15) ) + ROM_LOAD( "ras3", 0x2000, 0x1000, CRC(20d56f3e) SHA1(5c32ee3365407e6d3f7ab5662e9ecbac437ed4cb) ) + ROM_LOAD( "ras4", 0x3000, 0x1000, CRC(130e66db) SHA1(385b8f889fee08fddbb2f75a691af569109eacd1) ) ROM_REGION( 0x0200, REGION_PROMS, 0 ) /* color PROM */ - ROM_LOAD( "m-257sc.1a", 0x0000, 0x0200, CRC(b1aca792) SHA1(db37f99b9880cc3c434e2a55a0bbb017d9a72aa3) ) + ROM_LOAD( "m-257sc.1a", 0x0000, 0x0200, CRC(b1aca792) SHA1(db37f99b9880cc3c434e2a55a0bbb017d9a72aa3) ) ROM_END ROM_START( demoneye ) ROM_REGION( 0x10000, REGION_CPU1, 0 ) - ROM_LOAD( "demoneye.6", 0x6000, 0x1000, CRC(b03ee3a9) SHA1(66b6115fbb4e8097152702022c59c464e8211e5a) ) - ROM_LOAD( "demoneye.7", 0x7000, 0x1000, CRC(667a5de7) SHA1(c3ce7fbbc6c98250e9d5f85854e6887017ca5ff9) ) - ROM_LOAD( "demoneye.8", 0x8000, 0x1000, CRC(257484d7) SHA1(3937cce546462a471adbdc1da63ddfc20cfc7b79) ) - ROM_LOAD( "demoneye.9", 0x9000, 0x1000, CRC(bd8d79a8) SHA1(68c1443ef78b545eb9e612573b86515c3ad7f103) ) - ROM_LOAD( "demoneye.a", 0xa000, 0x1000, CRC(a27d08aa) SHA1(659ad22778e852fc58f3951d62bc01151c973d36) ) - ROM_LOAD( "demoneye.b", 0xb000, 0x1000, CRC(1fd3585b) SHA1(b1697b7b21b739499fda1e155530dbfab89f3358) ) + ROM_LOAD( "demoneye.6", 0x6000, 0x1000, CRC(b03ee3a9) SHA1(66b6115fbb4e8097152702022c59c464e8211e5a) ) + ROM_LOAD( "demoneye.7", 0x7000, 0x1000, CRC(667a5de7) SHA1(c3ce7fbbc6c98250e9d5f85854e6887017ca5ff9) ) + ROM_LOAD( "demoneye.8", 0x8000, 0x1000, CRC(257484d7) SHA1(3937cce546462a471adbdc1da63ddfc20cfc7b79) ) + ROM_LOAD( "demoneye.9", 0x9000, 0x1000, CRC(bd8d79a8) SHA1(68c1443ef78b545eb9e612573b86515c3ad7f103) ) + ROM_LOAD( "demoneye.a", 0xa000, 0x1000, CRC(a27d08aa) SHA1(659ad22778e852fc58f3951d62bc01151c973d36) ) + ROM_LOAD( "demoneye.b", 0xb000, 0x1000, CRC(1fd3585b) SHA1(b1697b7b21b739499fda1e155530dbfab89f3358) ) ROM_REGION( 0x10000, REGION_CPU2, 0 ) - ROM_LOAD( "demoneye.7s", 0x2000, 0x1000, CRC(8fdc9364) SHA1(3fccb5b22f08d6a0cde85863c1ce5399c84f233e) ) - ROM_LOAD( "demoneye.6s", 0xf000, 0x1000, CRC(0a23def9) SHA1(b52f52be312ec7810e3c9cbd3913e887f983b1ee) ) + ROM_LOAD( "demoneye.7s", 0x2000, 0x1000, CRC(8fdc9364) SHA1(3fccb5b22f08d6a0cde85863c1ce5399c84f233e) ) + ROM_LOAD( "demoneye.6s", 0x3000, 0x1000, CRC(0a23def9) SHA1(b52f52be312ec7810e3c9cbd3913e887f983b1ee) ) - ROM_REGION( 0x0400, REGION_PROMS, 0 ) /* unknow */ + ROM_REGION( 0x0200, REGION_PROMS, 0 ) /* color PROM */ + ROM_LOAD( "demoneye.1a2", 0x0000, 0x0200, CRC(eaf5a66e) SHA1(d8ebe05ba5d75fbf6ad45f710e5bd27b6afad44b) ) + + ROM_REGION( 0x0200, REGION_USER1, 0 ) /* unknown */ ROM_LOAD( "demoneye.1a", 0x0000, 0x0200, CRC(d03488ea) SHA1(11027f502ad2a9255b2e5611ab2eee16ede1d704) ) - ROM_LOAD( "demoneye.1a2", 0x0200, 0x0200, CRC(eaf5a66e) SHA1(d8ebe05ba5d75fbf6ad45f710e5bd27b6afad44b) ) ROM_END @@ -366,4 +359,4 @@ ROM_END *************************************/ GAME( 1981, redalert, 0, redalert, redalert, 0, ROT270, "Irem + GDI", "Red Alert", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) -GAME( 1981, demoneye, 0, demoneye, demoneye, 0, ROT270, "Irem", "Demoneye-X", GAME_WRONG_COLORS | GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1981, demoneye, 0, demoneye, demoneye, 0, ROT270, "Irem", "Demoneye-X", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/redalert.h b/src/mame/includes/redalert.h index 4d7f0a08113..9fa921f6a8d 100644 --- a/src/mame/includes/redalert.h +++ b/src/mame/includes/redalert.h @@ -12,7 +12,10 @@ WRITE8_HANDLER( redalert_audio_command_w ); WRITE8_HANDLER( redalert_voice_command_w ); +WRITE8_HANDLER( demoneye_audio_command_w ); + MACHINE_DRIVER_EXTERN( redalert_audio ); +MACHINE_DRIVER_EXTERN( demoneye_audio ); /*----------- defined in video/redalert.c -----------*/ @@ -24,3 +27,4 @@ extern UINT8 *redalert_video_control; WRITE8_HANDLER( redalert_bitmap_videoram_w ); MACHINE_DRIVER_EXTERN( redalert_video ); +MACHINE_DRIVER_EXTERN( demoneye_video ); diff --git a/src/mame/video/redalert.c b/src/mame/video/redalert.c index 0a47620ae47..c88f3839a6d 100644 --- a/src/mame/video/redalert.c +++ b/src/mame/video/redalert.c @@ -145,7 +145,7 @@ static VIDEO_START( redalert ) /************************************* * - * Video update + * Red Alert video update * *************************************/ @@ -168,7 +168,7 @@ static VIDEO_UPDATE( redalert ) UINT8 bitmap_data = redalert_bitmap_videoram[offs]; UINT8 bitmap_color = redalert_bitmap_colorram[offs >> 3]; - UINT8 charmap_code = redalert_charmap_videoram[offs >> 3]; + UINT8 charmap_code = redalert_charmap_videoram[0x0000 | (offs >> 3)]; offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); /* D7 of the char code selects the char set to use */ @@ -217,7 +217,83 @@ static VIDEO_UPDATE( redalert ) /************************************* * - * Machine driver + * Demoneye-X video update + * + *************************************/ + +static VIDEO_UPDATE( demoneye ) +{ + pen_t pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS + 1]; + offs_t offs; + + get_pens(pens); + + for (offs = 0; offs < 0x2000; offs++) + { + int i; + UINT8 charmap_data_1; + UINT8 charmap_data_2; + + UINT8 y = offs & 0xff; + UINT8 x = (~offs >> 8) << 3; + + UINT8 bitmap_data = redalert_bitmap_videoram[offs]; + UINT8 bitmap_color = redalert_bitmap_colorram[offs >> 3]; + + UINT8 charmap_code = redalert_charmap_videoram[0x1000 | (offs >> 3)]; + offs_t charmap_data_base = ((charmap_code & 0x7f) << 3) | (offs & 0x07); + + /* D7 of the char code selects the char set to use */ + if (charmap_code & 0x80) + { + charmap_data_1 = redalert_charmap_videoram[0x0400 | charmap_data_base]; + charmap_data_2 = redalert_charmap_videoram[0x0c00 | charmap_data_base]; + } + else + { + charmap_data_1 = redalert_charmap_videoram[0x0000 | charmap_data_base]; + charmap_data_2 = redalert_charmap_videoram[0x0800 | charmap_data_base]; + } + + /* this is the mapping of the 3rd char set */ + //charmap_data_1 = redalert_charmap_videoram[0x1400 | charmap_data_base]; + //charmap_data_2 = redalert_charmap_videoram[0x1c00 | charmap_data_base]; + + for (i = 0; i < 8; i++) + { + pen_t pen; + + int bitmap_bit = bitmap_data & 0x80; + UINT8 color_prom_a0_a1 = ((charmap_data_2 & 0x80) >> 6) | ((charmap_data_1 & 0x80) >> 7); + + /* determine priority */ + if ((color_prom_a0_a1 == 0) || (bitmap_bit && ((charmap_code & 0xc0) == 0xc0))) + pen = bitmap_bit ? pens[NUM_CHARMAP_PENS + bitmap_color] : pens[NUM_CHARMAP_PENS + NUM_BITMAP_PENS]; + else + pen = pens[((charmap_code & 0xfe) << 1) | color_prom_a0_a1]; + + if (*redalert_video_control & 0x04) + *BITMAP_ADDR32(bitmap, y ^ 0xff, x ^ 0xff) = pen; + else + *BITMAP_ADDR32(bitmap, y, x) = pen; + + /* next pixel */ + x = x + 1; + + bitmap_data = bitmap_data << 1; + charmap_data_1 = charmap_data_1 << 1; + charmap_data_2 = charmap_data_2 << 1; + } + } + + return 0; +} + + + +/************************************* + * + * Red Alert machine driver * *************************************/ @@ -235,3 +311,26 @@ MACHINE_DRIVER_START( redalert_video ) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) MACHINE_DRIVER_END + + + +/************************************* + * + * Demoneye-X machine driver + * + *************************************/ + +MACHINE_DRIVER_START( demoneye_video ) + + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION) + + MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) + MDRV_VIDEO_START(redalert) + MDRV_VIDEO_UPDATE(demoneye) + + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) + MDRV_SCREEN_SIZE(32*8, 32*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) + +MACHINE_DRIVER_END