mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
untangle ladybug and redclash state classes
This commit is contained in:
parent
0257b7cc4c
commit
836c43f630
@ -4139,6 +4139,7 @@ files {
|
||||
MAME_DIR .. "src/mame/drivers/ladybug.cpp",
|
||||
MAME_DIR .. "src/mame/includes/ladybug.h",
|
||||
MAME_DIR .. "src/mame/video/ladybug.cpp",
|
||||
MAME_DIR .. "src/mame/video/ladybug.h",
|
||||
MAME_DIR .. "src/mame/drivers/mrdo.cpp",
|
||||
MAME_DIR .. "src/mame/includes/mrdo.h",
|
||||
MAME_DIR .. "src/mame/video/mrdo.cpp",
|
||||
|
@ -167,14 +167,14 @@ double compute_resistor_weights(
|
||||
int count_2, const int * resistances_2, double * weights_2, int pulldown_2, int pullup_2,
|
||||
int count_3, const int * resistances_3, double * weights_3, int pulldown_3, int pullup_3 );
|
||||
|
||||
#define combine_8_weights(tab,w0,w1,w2,w3,w4,w5,w6,w7) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5) + (tab)[6]*(w6) + (tab)[7]*(w7)) + 0.5))
|
||||
#define combine_7_weights(tab,w0,w1,w2,w3,w4,w5,w6) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5) + (tab)[6]*(w6)) + 0.5))
|
||||
#define combine_6_weights(tab,w0,w1,w2,w3,w4,w5) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5)) + 0.5))
|
||||
#define combine_5_weights(tab,w0,w1,w2,w3,w4) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4)) + 0.5))
|
||||
#define combine_4_weights(tab,w0,w1,w2,w3) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3)) + 0.5))
|
||||
#define combine_3_weights(tab,w0,w1,w2) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2)) + 0.5))
|
||||
#define combine_2_weights(tab,w0,w1) ((int)(((tab)[0]*(w0) + (tab)[1]*(w1)) + 0.5))
|
||||
#define combine_1_weights(tab,w0) ((int)(((tab)[0]*(w0) + 0.5)))
|
||||
#define combine_8_weights(tab,w0,w1,w2,w3,w4,w5,w6,w7) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5) + (tab)[6]*(w6) + (tab)[7]*(w7)) + 0.5))
|
||||
#define combine_7_weights(tab,w0,w1,w2,w3,w4,w5,w6) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5) + (tab)[6]*(w6)) + 0.5))
|
||||
#define combine_6_weights(tab,w0,w1,w2,w3,w4,w5) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4) + (tab)[5]*(w5)) + 0.5))
|
||||
#define combine_5_weights(tab,w0,w1,w2,w3,w4) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3) + (tab)[4]*(w4)) + 0.5))
|
||||
#define combine_4_weights(tab,w0,w1,w2,w3) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2) + (tab)[3]*(w3)) + 0.5))
|
||||
#define combine_3_weights(tab,w0,w1,w2) (int(((tab)[0]*(w0) + (tab)[1]*(w1) + (tab)[2]*(w2)) + 0.5))
|
||||
#define combine_2_weights(tab,w0,w1) (int(((tab)[0]*(w0) + (tab)[1]*(w1)) + 0.5))
|
||||
#define combine_1_weights(tab,w0) (int(((tab)[0]*(w0) + 0.5)))
|
||||
|
||||
|
||||
|
||||
|
@ -69,11 +69,52 @@ TODO:
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
// Protection?
|
||||
READ8_MEMBER(sraider_state::sraider_8005_r)
|
||||
{
|
||||
// This must return X011111X or cpu #1 will hang
|
||||
// see code at rst $10
|
||||
return 0x3e;
|
||||
}
|
||||
|
||||
// Unknown IO
|
||||
WRITE8_MEMBER(sraider_state::sraider_misc_w)
|
||||
{
|
||||
switch(offset)
|
||||
{
|
||||
// These 8 bits are stored in the latch at A7
|
||||
case 0x00:
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
case 0x04:
|
||||
case 0x05:
|
||||
case 0x06:
|
||||
case 0x07:
|
||||
m_weird_value[offset & 7] = data & 1;
|
||||
break;
|
||||
// These 6 bits are stored in the latch at N7
|
||||
case 0x08:
|
||||
m_sraider_0x30 = data & 0x3f;
|
||||
break;
|
||||
// These 6 bits are stored in the latch at N8
|
||||
case 0x10:
|
||||
m_sraider_0x38 = data & 0x3f;
|
||||
break;
|
||||
default:
|
||||
logerror("(%s) write to %02X\n", machine().describe_context(), offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ADDRESS_MAP_START(ladybug_state::ladybug_map)
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM
|
||||
AM_RANGE(0x7000, 0x73ff) AM_WRITEONLY AM_SHARE("spriteram")
|
||||
AM_RANGE(0x7000, 0x73ff) AM_DEVWRITE("video", ladybug_video_device, spr_w)
|
||||
AM_RANGE(0x8000, 0x8fff) AM_READNOP
|
||||
AM_RANGE(0x9000, 0x9000) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x9001, 0x9001) AM_READ_PORT("IN1")
|
||||
@ -82,15 +123,52 @@ ADDRESS_MAP_START(ladybug_state::ladybug_map)
|
||||
AM_RANGE(0xa000, 0xa007) AM_DEVWRITE("videolatch", ls259_device, write_d0)
|
||||
AM_RANGE(0xb000, 0xbfff) AM_DEVWRITE("sn1", sn76489_device, write)
|
||||
AM_RANGE(0xc000, 0xcfff) AM_DEVWRITE("sn2", sn76489_device, write)
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(ladybug_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(ladybug_colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_DEVREADWRITE("video", ladybug_video_device, bg_r, bg_w)
|
||||
AM_RANGE(0xe000, 0xe000) AM_READ_PORT("IN2")
|
||||
ADDRESS_MAP_END
|
||||
|
||||
ADDRESS_MAP_START(ladybug_state::decrypted_opcodes_map)
|
||||
|
||||
ADDRESS_MAP_START(dorodon_state::decrypted_opcodes_map)
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM AM_SHARE("decrypted_opcodes")
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
ADDRESS_MAP_START(sraider_state::sraider_cpu1_map)
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM
|
||||
AM_RANGE(0x7000, 0x73ff) AM_DEVWRITE("video", ladybug_video_device, spr_w)
|
||||
AM_RANGE(0x8005, 0x8005) AM_READ(sraider_8005_r) // protection check?
|
||||
AM_RANGE(0x8006, 0x8006) AM_WRITEONLY AM_SHARE("sound_low")
|
||||
AM_RANGE(0x8007, 0x8007) AM_WRITEONLY AM_SHARE("sound_high")
|
||||
AM_RANGE(0x9000, 0x9000) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x9001, 0x9001) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0x9002, 0x9002) AM_READ_PORT("DSW0")
|
||||
AM_RANGE(0x9003, 0x9003) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_DEVWRITE("video", ladybug_video_device, bg_w)
|
||||
AM_RANGE(0xe000, 0xe000) AM_WRITENOP //unknown 0x10 when in attract, 0x20 when coined/playing
|
||||
ADDRESS_MAP_END
|
||||
|
||||
ADDRESS_MAP_START(sraider_state::sraider_cpu2_map)
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x63ff) AM_RAM
|
||||
AM_RANGE(0x8000, 0x8000) AM_READONLY AM_SHARE("sound_low")
|
||||
AM_RANGE(0xa000, 0xa000) AM_READONLY AM_SHARE("sound_high")
|
||||
AM_RANGE(0xc000, 0xc000) AM_READNOP //some kind of sync
|
||||
AM_RANGE(0xe000, 0xe0ff) AM_WRITEONLY AM_SHARE("grid_data")
|
||||
AM_RANGE(0xe800, 0xe800) AM_WRITE(sraider_io_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
ADDRESS_MAP_START(sraider_state::sraider_cpu2_io_map)
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_DEVWRITE("sn1", sn76489_device, write)
|
||||
AM_RANGE(0x08, 0x08) AM_DEVWRITE("sn2", sn76489_device, write)
|
||||
AM_RANGE(0x10, 0x10) AM_DEVWRITE("sn3", sn76489_device, write)
|
||||
AM_RANGE(0x18, 0x18) AM_DEVWRITE("sn4", sn76489_device, write)
|
||||
AM_RANGE(0x20, 0x20) AM_DEVWRITE("sn5", sn76489_device, write)
|
||||
AM_RANGE(0x28, 0x3f) AM_WRITE(sraider_misc_w) // lots unknown
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
INPUT_CHANGED_MEMBER(ladybug_state::coin1_inserted)
|
||||
{
|
||||
/* left coin insertion causes an NMI */
|
||||
@ -105,9 +183,6 @@ INPUT_CHANGED_MEMBER(ladybug_state::coin2_inserted)
|
||||
}
|
||||
|
||||
|
||||
#define LADYBUG_P1_CONTROL_PORT_TAG ("CONTP1")
|
||||
#define LADYBUG_P2_CONTROL_PORT_TAG ("CONTP2")
|
||||
|
||||
CUSTOM_INPUT_MEMBER(ladybug_state::ladybug_p1_control_r)
|
||||
{
|
||||
return m_p1_control->read();
|
||||
@ -115,32 +190,25 @@ CUSTOM_INPUT_MEMBER(ladybug_state::ladybug_p1_control_r)
|
||||
|
||||
CUSTOM_INPUT_MEMBER(ladybug_state::ladybug_p2_control_r)
|
||||
{
|
||||
uint32_t ret;
|
||||
|
||||
/* upright cabinet only uses a single set of controls */
|
||||
if (m_port_dsw0->read() & 0x20)
|
||||
ret = m_p2_control->read();
|
||||
else
|
||||
ret = m_p1_control->read();
|
||||
|
||||
return ret;
|
||||
// upright cabinet only uses a single set of controls */
|
||||
return ((m_port_dsw0->read() & 0x20) ? m_p2_control : m_p1_control)->read();
|
||||
}
|
||||
|
||||
|
||||
static INPUT_PORTS_START( ladybug )
|
||||
PORT_START("IN0")
|
||||
PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ladybug_state,ladybug_p1_control_r, nullptr)
|
||||
PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ladybug_state, ladybug_p1_control_r, nullptr)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
|
||||
|
||||
PORT_START("IN1")
|
||||
PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ladybug_state,ladybug_p2_control_r, nullptr)
|
||||
/* This should be connected to the 4V clock. I don't think the game uses it. */
|
||||
PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, ladybug_state, ladybug_p2_control_r, nullptr)
|
||||
// This should be connected to the 4V clock. I don't think the game uses it.
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
/* Note that there are TWO VBlank inputs, one is active low, the other active */
|
||||
/* high. There are probably other differencies in the hardware, but emulating */
|
||||
/* them this way is enough to get the game running. */
|
||||
// Note that there are TWO VBlank inputs, one is active low, the other active
|
||||
// high. There are probably other differencies in the hardware, but emulating
|
||||
// them this way is enough to get the game running.
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
|
||||
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
|
||||
|
||||
@ -202,14 +270,14 @@ static INPUT_PORTS_START( ladybug )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, ladybug_state,coin1_inserted, 0)
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, ladybug_state,coin2_inserted, 0)
|
||||
|
||||
PORT_START(LADYBUG_P1_CONTROL_PORT_TAG)
|
||||
PORT_START("CONTP1")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
|
||||
PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
|
||||
|
||||
PORT_START(LADYBUG_P2_CONTROL_PORT_TAG)
|
||||
PORT_START("CONTP2")
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
|
||||
@ -471,6 +539,82 @@ static INPUT_PORTS_START( dorodon )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, ladybug_state,coin2_inserted, 0)
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( sraider )
|
||||
PORT_START("IN0") /* IN0 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("IN1") /* IN1 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
|
||||
|
||||
PORT_START("DSW0") /* DSW0 */
|
||||
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
|
||||
PORT_DIPNAME( 0x04, 0x04, "High Score Names" )
|
||||
PORT_DIPSETTING( 0x00, "3 Letters" )
|
||||
PORT_DIPSETTING( 0x04, "10 Letters" )
|
||||
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Allow_Continue ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( No ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
|
||||
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) )
|
||||
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
|
||||
PORT_DIPSETTING( 0x00, "2" )
|
||||
PORT_DIPSETTING( 0xc0, "3" )
|
||||
PORT_DIPSETTING( 0x80, "4" )
|
||||
PORT_DIPSETTING( 0x40, "5" )
|
||||
|
||||
/* Free Play setting works when it's set for both */
|
||||
PORT_START("DSW1") /* DSW1 */
|
||||
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
|
||||
/* settings 0x00 through 0x05 all give 1 Coin/1 Credit */
|
||||
PORT_DIPSETTING( 0x06, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0x0a, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x07, DEF_STR( 3C_2C ) )
|
||||
PORT_DIPSETTING( 0x09, DEF_STR( 2C_2C ) )
|
||||
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
|
||||
PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
|
||||
/* settings 0x00 through 0x50 all give 1 Coin/1 Credit */
|
||||
PORT_DIPSETTING( 0x60, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0xa0, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x70, DEF_STR( 3C_2C ) )
|
||||
PORT_DIPSETTING( 0x90, DEF_STR( 2C_2C ) )
|
||||
PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
8,8, /* 8*8 characters */
|
||||
@ -481,6 +625,17 @@ static const gfx_layout charlayout =
|
||||
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
|
||||
8*8 /* every char takes 8 consecutive bytes */
|
||||
};
|
||||
static const gfx_layout charlayout2 =
|
||||
{
|
||||
8,8, /* 8*8 characters */
|
||||
512, /* 512 characters */
|
||||
2, /* 2 bits per pixel */
|
||||
{ 0, 512*8*8 }, /* the two bitplanes are separated */
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
|
||||
8*8 /* every char takes 8 consecutive bytes */
|
||||
};
|
||||
|
||||
static const gfx_layout spritelayout =
|
||||
{
|
||||
16,16, /* 16*16 sprites */
|
||||
@ -504,16 +659,63 @@ static const gfx_layout spritelayout2 =
|
||||
16*8 /* every sprite takes 16 consecutive bytes */
|
||||
};
|
||||
|
||||
static const gfx_layout gridlayout =
|
||||
{
|
||||
8,8, /* 8*8 characters */
|
||||
512, /* 512 characters */
|
||||
1, /* 1 bit per pixel */
|
||||
{ 0 },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8},
|
||||
8*8 /* every char takes 8 consecutive bytes */
|
||||
};
|
||||
static const gfx_layout gridlayout2 =
|
||||
{
|
||||
8,8, /* 8*8 characters */
|
||||
512, /* 512 characters */
|
||||
1, /* 1 bit per pixel */
|
||||
{ 0 },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
|
||||
8*8 /* every char takes 8 consecutive bytes */
|
||||
};
|
||||
|
||||
static GFXDECODE_START( ladybug )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 8 )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 4*8, 16 )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout2, 4*8, 16 )
|
||||
GFXDECODE_END
|
||||
|
||||
void ladybug_state::machine_start()
|
||||
static GFXDECODE_START( sraider )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, charlayout2, 0, 8 )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 4*8, 16 )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout2, 4*8, 16 )
|
||||
GFXDECODE_ENTRY( "gfx3", 0, gridlayout, 4*8+4*16+32, 1 )
|
||||
GFXDECODE_ENTRY( "gfx3", 0, gridlayout2, 4*8+4*16+32, 1 )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
void sraider_state::machine_start()
|
||||
{
|
||||
ladybug_base_state::machine_start();
|
||||
|
||||
save_item(NAME(m_grid_color));
|
||||
save_item(NAME(m_sraider_0x30));
|
||||
save_item(NAME(m_sraider_0x38));
|
||||
save_item(NAME(m_weird_value));
|
||||
}
|
||||
|
||||
void sraider_state::machine_reset()
|
||||
{
|
||||
ladybug_base_state::machine_reset();
|
||||
|
||||
m_grid_color = 0;
|
||||
m_sraider_0x30 = 0;
|
||||
m_sraider_0x38 = 0;
|
||||
std::fill(std::begin(m_weird_value), std::end(m_weird_value), 0);
|
||||
}
|
||||
|
||||
|
||||
MACHINE_CONFIG_START(ladybug_state::ladybug)
|
||||
|
||||
/* basic machine hardware */
|
||||
@ -534,6 +736,9 @@ MACHINE_CONFIG_START(ladybug_state::ladybug)
|
||||
MCFG_PALETTE_INDIRECT_ENTRIES(32)
|
||||
MCFG_PALETTE_INIT_OWNER(ladybug_state,ladybug)
|
||||
|
||||
MCFG_DEVICE_ADD("video", LADYBUG_VIDEO, 4000000)
|
||||
MCFG_LADYBUG_VIDEO_GFXDECODE("gfxdecode")
|
||||
|
||||
MCFG_DEVICE_ADD("videolatch", LS259, 0) // L5 on video board or H3 on single board
|
||||
MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(ladybug_state, flipscreen_w)) // no other outputs used
|
||||
|
||||
@ -547,12 +752,64 @@ MACHINE_CONFIG_START(ladybug_state::ladybug)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(ladybug_state::dorodon)
|
||||
MACHINE_CONFIG_START(dorodon_state::dorodon)
|
||||
ladybug(config);
|
||||
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_OPCODES_MAP(decrypted_opcodes_map)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(sraider_state::sraider)
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(sraider_cpu1_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", sraider_state, irq0_line_hold)
|
||||
|
||||
MCFG_CPU_ADD("sub", Z80, 4000000) /* 4 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(sraider_cpu2_map)
|
||||
MCFG_CPU_IO_MAP(sraider_cpu2_io_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", sraider_state, irq0_line_hold)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 4*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(sraider_state, screen_update_sraider)
|
||||
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(sraider_state, screen_vblank_sraider))
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", sraider)
|
||||
MCFG_PALETTE_ADD("palette", 4*8+4*16+32+2)
|
||||
MCFG_PALETTE_INDIRECT_ENTRIES(32+32+1)
|
||||
MCFG_PALETTE_INIT_OWNER(sraider_state,sraider)
|
||||
|
||||
MCFG_DEVICE_ADD("video", LADYBUG_VIDEO, 4000000)
|
||||
MCFG_LADYBUG_VIDEO_GFXDECODE("gfxdecode")
|
||||
|
||||
MCFG_DEVICE_ADD("stars", ZEROHOUR_STARS, 0)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("sn1", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn2", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn3", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn4", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn5", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -729,7 +986,36 @@ ROM_START( dorodon2 )
|
||||
ROM_LOAD( "dorodon.bp2", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* timing?? */
|
||||
ROM_END
|
||||
|
||||
DRIVER_INIT_MEMBER(ladybug_state,dorodon)
|
||||
ROM_START( sraider )
|
||||
ROM_REGION( 0x10000, "maincpu", 0 )
|
||||
ROM_LOAD( "sraid3.r4", 0x0000, 0x2000, CRC(0f389774) SHA1(c67596e6bf00175ff0a241506cd2f88114d05933) )
|
||||
ROM_LOAD( "sraid2.n4", 0x2000, 0x2000, CRC(38a48db0) SHA1(6f4f384d702fb8ee4bb2ef579638239d57e32ddd) )
|
||||
ROM_LOAD( "sraid1.m4", 0x4000, 0x2000, CRC(2f302a4e) SHA1(3a902ce6858f38df88b60830bef4b1d45b09b2df) )
|
||||
|
||||
ROM_REGION( 0x10000, "sub", 0 )
|
||||
ROM_LOAD( "sraid-s4.h6", 0x0000, 0x2000, CRC(57173a12) SHA1(6cb8fd4826e499f9a4e63621d58bc4b596cc261e) )
|
||||
ROM_LOAD( "sraid-s5.j6", 0x2000, 0x2000, CRC(5a459179) SHA1(a261c8f3c7c4cd4587c003bbbe815d2c4e01ffbc) )
|
||||
ROM_LOAD( "sraid-s6.l6", 0x4000, 0x2000, CRC(ea3aa25d) SHA1(353c0d075d5e0a3bc25a65e2748f5eb5212a844d) )
|
||||
|
||||
ROM_REGION( 0x2000, "gfx1", 0 )
|
||||
ROM_LOAD( "sraid-s0.k6", 0x0000, 0x1000, CRC(a0373909) SHA1(00e3bd5dd90769d670fc3c51edd1cd4b69e6132d) )
|
||||
ROM_LOAD( "sraids11.l6", 0x1000, 0x1000, CRC(ba22d949) SHA1(83762ced1df92ff594887e44d5b783826bbfb0c9) )
|
||||
|
||||
ROM_REGION( 0x2000, "gfx2", 0 )
|
||||
ROM_LOAD( "sraid-s7.m2", 0x0000, 0x1000, CRC(299f8e07) SHA1(1de71f251286088487da7285d6f8070147002af5) )
|
||||
ROM_LOAD( "sraid-s8.n2", 0x1000, 0x1000, CRC(57ba8888) SHA1(2aa1a5f682d146a55a96e471bb78e5c60da02bf9) )
|
||||
|
||||
ROM_REGION( 0x1000, "gfx3", 0 ) /* fixed portion of the grid */
|
||||
ROM_LOAD( "sraid-s9.f6", 0x0000, 0x1000, CRC(2380b90f) SHA1(0310554e3f2ec973c2bb6e816d04e5c0c1e0a0b9) )
|
||||
|
||||
ROM_REGION( 0x0060, "proms", 0 )
|
||||
ROM_LOAD( "srpr10-1.a2", 0x0000, 0x0020, CRC(121fdb99) SHA1(3bc092da40beb129a4df3db2f55d22bbbcf7bad8) )
|
||||
ROM_LOAD( "srpr10-2.l3", 0x0020, 0x0020, CRC(88b67e70) SHA1(e21ee2939e96dffee101bd92c62ed975b6b64001) )
|
||||
ROM_LOAD( "srpr10-3.c1", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* ?? */
|
||||
ROM_END
|
||||
|
||||
|
||||
DRIVER_INIT_MEMBER(dorodon_state, dorodon)
|
||||
{
|
||||
/* decode the opcodes */
|
||||
|
||||
@ -746,6 +1032,7 @@ GAME( 1981, cavenger, 0, ladybug, cavenger, ladybug_state, 0, ROT0,
|
||||
GAME( 1981, ladybug, 0, ladybug, ladybug, ladybug_state, 0, ROT270, "Universal", "Lady Bug", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1981, ladybugb, ladybug, ladybug, ladybug, ladybug_state, 0, ROT270, "bootleg", "Lady Bug (bootleg set 1)", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1981, ladybugb2, ladybug, ladybug, ladybug, ladybug_state, 0, ROT270, "bootleg (Model Racing)", "Coccinelle (bootleg of Lady Bug, set 2)", MACHINE_SUPPORTS_SAVE ) // title removed, but manual names it Coccinelle
|
||||
GAME( 1982, dorodon, 0, dorodon, dorodon, ladybug_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 1)", MACHINE_SUPPORTS_SAVE ) // license or bootleg?
|
||||
GAME( 1982, dorodon2, dorodon, dorodon, dorodon, ladybug_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 2)", MACHINE_SUPPORTS_SAVE ) // "
|
||||
GAME( 1982, dorodon, 0, dorodon, dorodon, dorodon_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 1)", MACHINE_SUPPORTS_SAVE ) // license or bootleg?
|
||||
GAME( 1982, dorodon2, dorodon, dorodon, dorodon, dorodon_state, dorodon, ROT270, "UPL (Falcon license?)", "Dorodon (set 2)", MACHINE_SUPPORTS_SAVE ) // "
|
||||
GAME( 1982, snapjack, 0, ladybug, snapjack, ladybug_state, 0, ROT0, "Universal", "Snap Jack", MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1982, sraider, 0, sraider, sraider, sraider_state, 0, ROT270, "Universal", "Space Raider", MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -31,109 +31,16 @@ TODO:
|
||||
#include "speaker.h"
|
||||
|
||||
|
||||
/* Sound comm between CPU's */
|
||||
READ8_MEMBER(redclash_state::sraider_sound_low_r)
|
||||
{
|
||||
return m_sound_low;
|
||||
}
|
||||
|
||||
READ8_MEMBER(redclash_state::sraider_sound_high_r)
|
||||
{
|
||||
return m_sound_high;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(redclash_state::sraider_sound_low_w)
|
||||
{
|
||||
m_sound_low = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(redclash_state::sraider_sound_high_w)
|
||||
{
|
||||
m_sound_high = data;
|
||||
}
|
||||
|
||||
/* Protection? */
|
||||
READ8_MEMBER(redclash_state::sraider_8005_r)
|
||||
{
|
||||
/* This must return X011111X or cpu #1 will hang */
|
||||
/* see code at rst $10 */
|
||||
return 0x3e;
|
||||
}
|
||||
|
||||
/* Unknown IO */
|
||||
WRITE8_MEMBER(redclash_state::sraider_misc_w)
|
||||
{
|
||||
switch(offset)
|
||||
{
|
||||
/* These 8 bits are stored in the latch at A7 */
|
||||
case 0x00:
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
case 0x04:
|
||||
case 0x05:
|
||||
case 0x06:
|
||||
case 0x07:
|
||||
m_weird_value[offset & 7] = data & 1;
|
||||
break;
|
||||
/* These 6 bits are stored in the latch at N7 */
|
||||
case 0x08:
|
||||
m_sraider_0x30 = data&0x3f;
|
||||
break;
|
||||
/* These 6 bits are stored in the latch at N8 */
|
||||
case 0x10:
|
||||
m_sraider_0x38 = data&0x3f;
|
||||
break;
|
||||
default:
|
||||
osd_printf_debug("(%04X) write to %02X\n", m_sub->pc(), offset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ADDRESS_MAP_START(redclash_state::sraider_cpu1_map)
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x6fff) AM_RAM
|
||||
AM_RANGE(0x7000, 0x73ff) AM_WRITEONLY AM_SHARE("spriteram")
|
||||
AM_RANGE(0x8005, 0x8005) AM_READ(sraider_8005_r) // protection check?
|
||||
AM_RANGE(0x8006, 0x8006) AM_WRITE(sraider_sound_low_w)
|
||||
AM_RANGE(0x8007, 0x8007) AM_WRITE(sraider_sound_high_w)
|
||||
AM_RANGE(0x9000, 0x9000) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x9001, 0x9001) AM_READ_PORT("IN1")
|
||||
AM_RANGE(0x9002, 0x9002) AM_READ_PORT("DSW0")
|
||||
AM_RANGE(0x9003, 0x9003) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0xd000, 0xd3ff) AM_WRITE(ladybug_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0xd400, 0xd7ff) AM_WRITE(ladybug_colorram_w) AM_SHARE("colorram")
|
||||
AM_RANGE(0xe000, 0xe000) AM_WRITENOP //unknown 0x10 when in attract, 0x20 when coined/playing
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
ADDRESS_MAP_START(redclash_state::sraider_cpu2_map)
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROM
|
||||
AM_RANGE(0x6000, 0x63ff) AM_RAM
|
||||
AM_RANGE(0x8000, 0x8000) AM_READ(sraider_sound_low_r)
|
||||
AM_RANGE(0xa000, 0xa000) AM_READ(sraider_sound_high_r)
|
||||
AM_RANGE(0xc000, 0xc000) AM_READNOP //some kind of sync
|
||||
AM_RANGE(0xe000, 0xe0ff) AM_WRITEONLY AM_SHARE("grid_data")
|
||||
AM_RANGE(0xe800, 0xe800) AM_WRITE(sraider_io_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
ADDRESS_MAP_START(redclash_state::sraider_cpu2_io_map)
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_DEVWRITE("sn1", sn76489_device, write)
|
||||
AM_RANGE(0x08, 0x08) AM_DEVWRITE("sn2", sn76489_device, write)
|
||||
AM_RANGE(0x10, 0x10) AM_DEVWRITE("sn3", sn76489_device, write)
|
||||
AM_RANGE(0x18, 0x18) AM_DEVWRITE("sn4", sn76489_device, write)
|
||||
AM_RANGE(0x20, 0x20) AM_DEVWRITE("sn5", sn76489_device, write)
|
||||
AM_RANGE(0x28, 0x3f) AM_WRITE(sraider_misc_w) // lots unknown
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
WRITE8_MEMBER( redclash_state::irqack_w )
|
||||
{
|
||||
m_maincpu->set_input_line(0, CLEAR_LINE);
|
||||
}
|
||||
|
||||
template <unsigned B> WRITE8_MEMBER(redclash_state::redclash_star_w)
|
||||
{
|
||||
m_stars->set_speed(BIT(data, 0) << B, 1U << B);
|
||||
}
|
||||
|
||||
ADDRESS_MAP_START(redclash_state::zerohour_map)
|
||||
AM_RANGE(0x0000, 0x2fff) AM_ROM
|
||||
AM_RANGE(0x3000, 0x37ff) AM_RAM
|
||||
@ -144,10 +51,10 @@ ADDRESS_MAP_START(redclash_state::zerohour_map)
|
||||
AM_RANGE(0x4802, 0x4802) AM_READ_PORT("DSW1") /* DSW0 */
|
||||
AM_RANGE(0x4803, 0x4803) AM_READ_PORT("DSW2") /* DSW1 */
|
||||
AM_RANGE(0x5000, 0x5007) AM_WRITENOP /* to sound board */
|
||||
AM_RANGE(0x5800, 0x5800) AM_WRITE(redclash_star0_w)
|
||||
AM_RANGE(0x5800, 0x5800) AM_WRITE(redclash_star_w<0>)
|
||||
AM_RANGE(0x5801, 0x5804) AM_WRITENOP /* to sound board */
|
||||
AM_RANGE(0x5805, 0x5805) AM_WRITE(redclash_star1_w)
|
||||
AM_RANGE(0x5806, 0x5806) AM_WRITE(redclash_star2_w)
|
||||
AM_RANGE(0x5805, 0x5805) AM_WRITE(redclash_star_w<1>)
|
||||
AM_RANGE(0x5806, 0x5806) AM_WRITE(redclash_star_w<2>)
|
||||
AM_RANGE(0x5807, 0x5807) AM_WRITE(redclash_flipscreen_w)
|
||||
AM_RANGE(0x7000, 0x7000) AM_WRITE(redclash_star_reset_w)
|
||||
AM_RANGE(0x7800, 0x7800) AM_WRITE(irqack_w)
|
||||
@ -163,10 +70,10 @@ ADDRESS_MAP_START(redclash_state::redclash_map)
|
||||
AM_RANGE(0x4802, 0x4802) AM_READ_PORT("DSW1") /* DSW0 */
|
||||
AM_RANGE(0x4803, 0x4803) AM_READ_PORT("DSW2") /* DSW1 */
|
||||
AM_RANGE(0x5000, 0x5007) AM_WRITENOP /* to sound board */
|
||||
AM_RANGE(0x5800, 0x5800) AM_WRITE(redclash_star0_w)
|
||||
AM_RANGE(0x5800, 0x5800) AM_WRITE(redclash_star_w<0>)
|
||||
AM_RANGE(0x5801, 0x5801) AM_WRITE(redclash_gfxbank_w)
|
||||
AM_RANGE(0x5805, 0x5805) AM_WRITE(redclash_star1_w)
|
||||
AM_RANGE(0x5806, 0x5806) AM_WRITE(redclash_star2_w)
|
||||
AM_RANGE(0x5805, 0x5805) AM_WRITE(redclash_star_w<1>)
|
||||
AM_RANGE(0x5806, 0x5806) AM_WRITE(redclash_star_w<2>)
|
||||
AM_RANGE(0x5807, 0x5807) AM_WRITE(redclash_flipscreen_w)
|
||||
AM_RANGE(0x6000, 0x67ff) AM_RAM
|
||||
AM_RANGE(0x6800, 0x6bff) AM_RAM AM_SHARE("spriteram")
|
||||
@ -361,81 +268,6 @@ static INPUT_PORTS_START( zerohour )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1) PORT_CHANGED_MEMBER(DEVICE_SELF, redclash_state, right_coin_inserted, 0)
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( sraider )
|
||||
PORT_START("IN0") /* IN0 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
|
||||
PORT_START("IN1") /* IN1 */
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
|
||||
|
||||
PORT_START("DSW0") /* DSW0 */
|
||||
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
|
||||
PORT_DIPSETTING( 0x03, DEF_STR( Easy ) )
|
||||
PORT_DIPSETTING( 0x02, DEF_STR( Medium ) )
|
||||
PORT_DIPSETTING( 0x01, DEF_STR( Hard ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
|
||||
PORT_DIPNAME( 0x04, 0x04, "High Score Names" )
|
||||
PORT_DIPSETTING( 0x00, "3 Letters" )
|
||||
PORT_DIPSETTING( 0x04, "10 Letters" )
|
||||
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Allow_Continue ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( No ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
|
||||
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
|
||||
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
|
||||
PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
|
||||
PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) )
|
||||
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
|
||||
PORT_DIPSETTING( 0x00, "2" )
|
||||
PORT_DIPSETTING( 0xc0, "3" )
|
||||
PORT_DIPSETTING( 0x80, "4" )
|
||||
PORT_DIPSETTING( 0x40, "5" )
|
||||
|
||||
/* Free Play setting works when it's set for both */
|
||||
PORT_START("DSW1") /* DSW1 */
|
||||
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
|
||||
/* settings 0x00 through 0x05 all give 1 Coin/1 Credit */
|
||||
PORT_DIPSETTING( 0x06, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0x0a, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x07, DEF_STR( 3C_2C ) )
|
||||
PORT_DIPSETTING( 0x09, DEF_STR( 2C_2C ) )
|
||||
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
|
||||
PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
|
||||
/* settings 0x00 through 0x50 all give 1 Coin/1 Credit */
|
||||
PORT_DIPSETTING( 0x60, DEF_STR( 4C_1C ) )
|
||||
PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) )
|
||||
PORT_DIPSETTING( 0xa0, DEF_STR( 2C_1C ) )
|
||||
PORT_DIPSETTING( 0x70, DEF_STR( 3C_2C ) )
|
||||
PORT_DIPSETTING( 0x90, DEF_STR( 2C_2C ) )
|
||||
PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
|
||||
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C ) )
|
||||
PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C ) )
|
||||
PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) )
|
||||
PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C ) )
|
||||
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
|
||||
INPUT_PORTS_END
|
||||
|
||||
static const gfx_layout charlayout =
|
||||
{
|
||||
8,8,
|
||||
@ -500,130 +332,15 @@ static GFXDECODE_START( redclash )
|
||||
GFXDECODE_ENTRY( "gfx2", 0x0004, spritelayout16x16bis, 4*8, 16 )
|
||||
GFXDECODE_END
|
||||
|
||||
static const gfx_layout charlayout2 =
|
||||
|
||||
void redclash_state::machine_start()
|
||||
{
|
||||
8,8, /* 8*8 characters */
|
||||
512, /* 512 characters */
|
||||
2, /* 2 bits per pixel */
|
||||
{ 0, 512*8*8 }, /* the two bitplanes are separated */
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
|
||||
8*8 /* every char takes 8 consecutive bytes */
|
||||
};
|
||||
static const gfx_layout spritelayout =
|
||||
{
|
||||
16,16, /* 16*16 sprites */
|
||||
128, /* 128 sprites */
|
||||
2, /* 2 bits per pixel */
|
||||
{ 1, 0 }, /* the two bitplanes are packed in two consecutive bits */
|
||||
{ 0, 2, 4, 6, 8, 10, 12, 14,
|
||||
8*16+0, 8*16+2, 8*16+4, 8*16+6, 8*16+8, 8*16+10, 8*16+12, 8*16+14 },
|
||||
{ 23*16, 22*16, 21*16, 20*16, 19*16, 18*16, 17*16, 16*16,
|
||||
7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 },
|
||||
64*8 /* every sprite takes 64 consecutive bytes */
|
||||
};
|
||||
static const gfx_layout spritelayout2 =
|
||||
{
|
||||
8,8, /* 8*8 sprites */
|
||||
512, /* 512 sprites */
|
||||
2, /* 2 bits per pixel */
|
||||
{ 1, 0 }, /* the two bitplanes are packed in two consecutive bits */
|
||||
{ 0, 2, 4, 6, 8, 10, 12, 14 },
|
||||
{ 7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 },
|
||||
16*8 /* every sprite takes 16 consecutive bytes */
|
||||
};
|
||||
|
||||
static const gfx_layout gridlayout =
|
||||
{
|
||||
8,8, /* 8*8 characters */
|
||||
512, /* 512 characters */
|
||||
1, /* 1 bit per pixel */
|
||||
{ 0 },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8},
|
||||
8*8 /* every char takes 8 consecutive bytes */
|
||||
};
|
||||
|
||||
static const gfx_layout gridlayout2 =
|
||||
{
|
||||
8,8, /* 8*8 characters */
|
||||
512, /* 512 characters */
|
||||
1, /* 1 bit per pixel */
|
||||
{ 0 },
|
||||
{ 7, 6, 5, 4, 3, 2, 1, 0 },
|
||||
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
|
||||
8*8 /* every char takes 8 consecutive bytes */
|
||||
};
|
||||
|
||||
static GFXDECODE_START( sraider )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, charlayout2, 0, 8 )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 4*8, 16 )
|
||||
GFXDECODE_ENTRY( "gfx2", 0, spritelayout2, 4*8, 16 )
|
||||
GFXDECODE_ENTRY( "gfx3", 0, gridlayout, 4*8+4*16+32, 1 )
|
||||
GFXDECODE_ENTRY( "gfx3", 0, gridlayout2, 4*8+4*16+32, 1 )
|
||||
GFXDECODE_END
|
||||
|
||||
MACHINE_START_MEMBER(redclash_state,sraider)
|
||||
{
|
||||
save_item(NAME(m_grid_color));
|
||||
save_item(NAME(m_sound_low));
|
||||
save_item(NAME(m_sound_high));
|
||||
save_item(NAME(m_sraider_0x30));
|
||||
save_item(NAME(m_sraider_0x38));
|
||||
save_item(NAME(m_weird_value));
|
||||
|
||||
/* for stars */
|
||||
save_item(NAME(m_star_speed));
|
||||
save_item(NAME(m_stars_enable));
|
||||
save_item(NAME(m_stars_speed));
|
||||
save_item(NAME(m_stars_state));
|
||||
save_item(NAME(m_stars_offset));
|
||||
save_item(NAME(m_stars_count));
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(redclash_state,sraider)
|
||||
{
|
||||
int i;
|
||||
|
||||
m_grid_color = 0;
|
||||
m_sound_low = 0;
|
||||
m_sound_high = 0;
|
||||
m_sraider_0x30 = 0;
|
||||
m_sraider_0x38 = 0;
|
||||
|
||||
/* for stars */
|
||||
m_star_speed = 0;
|
||||
m_stars_enable = 0;
|
||||
m_stars_speed = 0;
|
||||
m_stars_state = 0;
|
||||
m_stars_offset = 0;
|
||||
m_stars_count = 0;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
m_weird_value[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
MACHINE_START_MEMBER(redclash_state,redclash)
|
||||
{
|
||||
save_item(NAME(m_star_speed));
|
||||
save_item(NAME(m_gfxbank));
|
||||
save_item(NAME(m_stars_enable));
|
||||
save_item(NAME(m_stars_speed));
|
||||
save_item(NAME(m_stars_state));
|
||||
save_item(NAME(m_stars_offset));
|
||||
save_item(NAME(m_stars_count));
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(redclash_state,redclash)
|
||||
void redclash_state::machine_reset()
|
||||
{
|
||||
m_star_speed = 0;
|
||||
m_gfxbank = 0;
|
||||
m_stars_enable = 0;
|
||||
m_stars_speed = 0;
|
||||
m_stars_state = 0;
|
||||
m_stars_offset = 0;
|
||||
m_stars_count = 0;
|
||||
}
|
||||
|
||||
MACHINE_CONFIG_START(redclash_state::zerohour)
|
||||
@ -632,9 +349,6 @@ MACHINE_CONFIG_START(redclash_state::zerohour)
|
||||
MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(zerohour_map)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(redclash_state,redclash)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(redclash_state,redclash)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
@ -649,7 +363,8 @@ MACHINE_CONFIG_START(redclash_state::zerohour)
|
||||
MCFG_PALETTE_ADD("palette", 4*8+4*16+32)
|
||||
MCFG_PALETTE_INDIRECT_ENTRIES(32+32)
|
||||
MCFG_PALETTE_INIT_OWNER(redclash_state,redclash)
|
||||
MCFG_VIDEO_START_OVERRIDE(redclash_state,redclash)
|
||||
|
||||
MCFG_DEVICE_ADD("stars", ZEROHOUR_STARS, 0)
|
||||
|
||||
/* sound hardware */
|
||||
MACHINE_CONFIG_END
|
||||
@ -661,9 +376,6 @@ MACHINE_CONFIG_START(redclash_state::redclash)
|
||||
MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(redclash_map)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(redclash_state,redclash)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(redclash_state,redclash)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
@ -678,62 +390,12 @@ MACHINE_CONFIG_START(redclash_state::redclash)
|
||||
MCFG_PALETTE_ADD("palette", 4*8+4*16+32)
|
||||
MCFG_PALETTE_INDIRECT_ENTRIES(32+32)
|
||||
MCFG_PALETTE_INIT_OWNER(redclash_state,redclash)
|
||||
MCFG_VIDEO_START_OVERRIDE(redclash_state,redclash)
|
||||
|
||||
MCFG_DEVICE_ADD("stars", ZEROHOUR_STARS, 0)
|
||||
|
||||
/* sound hardware */
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
MACHINE_CONFIG_START(redclash_state::sraider)
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(sraider_cpu1_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", redclash_state, irq0_line_hold)
|
||||
|
||||
MCFG_CPU_ADD("sub", Z80, 4000000) /* 4 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(sraider_cpu2_map)
|
||||
MCFG_CPU_IO_MAP(sraider_cpu2_io_map)
|
||||
MCFG_CPU_VBLANK_INT_DRIVER("screen", redclash_state, irq0_line_hold)
|
||||
|
||||
MCFG_MACHINE_START_OVERRIDE(redclash_state,sraider)
|
||||
MCFG_MACHINE_RESET_OVERRIDE(redclash_state,sraider)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 4*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(redclash_state, screen_update_sraider)
|
||||
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(redclash_state, screen_vblank_sraider))
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", sraider)
|
||||
MCFG_PALETTE_ADD("palette", 4*8+4*16+32+2)
|
||||
MCFG_PALETTE_INDIRECT_ENTRIES(32+32+1)
|
||||
MCFG_PALETTE_INIT_OWNER(redclash_state,sraider)
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(redclash_state,sraider)
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MCFG_SOUND_ADD("sn1", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn2", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn3", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn4", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("sn5", SN76489, 4000000)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
@ -900,46 +562,17 @@ ROM_START( redclashk )
|
||||
ROM_LOAD( "3.11e", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* 6331.6w */
|
||||
ROM_END
|
||||
|
||||
ROM_START( sraider )
|
||||
ROM_REGION( 0x10000, "maincpu", 0 )
|
||||
ROM_LOAD( "sraid3.r4", 0x0000, 0x2000, CRC(0f389774) SHA1(c67596e6bf00175ff0a241506cd2f88114d05933) )
|
||||
ROM_LOAD( "sraid2.n4", 0x2000, 0x2000, CRC(38a48db0) SHA1(6f4f384d702fb8ee4bb2ef579638239d57e32ddd) )
|
||||
ROM_LOAD( "sraid1.m4", 0x4000, 0x2000, CRC(2f302a4e) SHA1(3a902ce6858f38df88b60830bef4b1d45b09b2df) )
|
||||
|
||||
ROM_REGION( 0x10000, "sub", 0 )
|
||||
ROM_LOAD( "sraid-s4.h6", 0x0000, 0x2000, CRC(57173a12) SHA1(6cb8fd4826e499f9a4e63621d58bc4b596cc261e) )
|
||||
ROM_LOAD( "sraid-s5.j6", 0x2000, 0x2000, CRC(5a459179) SHA1(a261c8f3c7c4cd4587c003bbbe815d2c4e01ffbc) )
|
||||
ROM_LOAD( "sraid-s6.l6", 0x4000, 0x2000, CRC(ea3aa25d) SHA1(353c0d075d5e0a3bc25a65e2748f5eb5212a844d) )
|
||||
|
||||
ROM_REGION( 0x2000, "gfx1", 0 )
|
||||
ROM_LOAD( "sraid-s0.k6", 0x0000, 0x1000, CRC(a0373909) SHA1(00e3bd5dd90769d670fc3c51edd1cd4b69e6132d) )
|
||||
ROM_LOAD( "sraids11.l6", 0x1000, 0x1000, CRC(ba22d949) SHA1(83762ced1df92ff594887e44d5b783826bbfb0c9) )
|
||||
|
||||
ROM_REGION( 0x2000, "gfx2", 0 )
|
||||
ROM_LOAD( "sraid-s7.m2", 0x0000, 0x1000, CRC(299f8e07) SHA1(1de71f251286088487da7285d6f8070147002af5) )
|
||||
ROM_LOAD( "sraid-s8.n2", 0x1000, 0x1000, CRC(57ba8888) SHA1(2aa1a5f682d146a55a96e471bb78e5c60da02bf9) )
|
||||
|
||||
ROM_REGION( 0x1000, "gfx3", 0 ) /* fixed portion of the grid */
|
||||
ROM_LOAD( "sraid-s9.f6", 0x0000, 0x1000, CRC(2380b90f) SHA1(0310554e3f2ec973c2bb6e816d04e5c0c1e0a0b9) )
|
||||
|
||||
ROM_REGION( 0x0060, "proms", 0 )
|
||||
ROM_LOAD( "srpr10-1.a2", 0x0000, 0x0020, CRC(121fdb99) SHA1(3bc092da40beb129a4df3db2f55d22bbbcf7bad8) )
|
||||
ROM_LOAD( "srpr10-2.l3", 0x0020, 0x0020, CRC(88b67e70) SHA1(e21ee2939e96dffee101bd92c62ed975b6b64001) )
|
||||
ROM_LOAD( "srpr10-3.c1", 0x0040, 0x0020, CRC(27fa3a50) SHA1(7cf59b7a37c156640d6ea91554d1c4276c1780e0) ) /* ?? */
|
||||
ROM_END
|
||||
|
||||
|
||||
DRIVER_INIT_MEMBER(redclash_state,redclash)
|
||||
DRIVER_INIT_MEMBER(redclash_state, redclash)
|
||||
{
|
||||
int i,j;
|
||||
const uint8_t *src = memregion("gfx2")->base();
|
||||
uint8_t *dst = memregion("gfx3")->base();
|
||||
int len = memregion("gfx3")->bytes();
|
||||
uint8_t const *const src = memregion("gfx2")->base();
|
||||
uint8_t *const dst = memregion("gfx3")->base();
|
||||
int const len = memregion("gfx3")->bytes();
|
||||
|
||||
/* rearrange the sprite graphics */
|
||||
for (i = 0;i < len;i++)
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
j = (i & ~0x003e) | ((i & 0x0e) << 2) | ((i & 0x30) >> 3);
|
||||
int const j = (i & ~0x003e) | ((i & 0x0e) << 2) | ((i & 0x30) >> 3);
|
||||
dst[i] = src[j];
|
||||
}
|
||||
}
|
||||
@ -951,4 +584,3 @@ GAME( 1980, zerohouri, zerohour, zerohour, zerohour, redclash_state, redclash, R
|
||||
GAME( 1981, redclash, 0, redclash, redclash, redclash_state, redclash, ROT270, "Tehkan", "Red Clash (set 1)", MACHINE_NO_SOUND | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1981, redclasha, redclash, redclash, redclash, redclash_state, redclash, ROT270, "Tehkan", "Red Clash (set 2)", MACHINE_NO_SOUND | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1981, redclashk, redclash, redclash, redclash, redclash_state, redclash, ROT270, "Tehkan (Kaneko license)", "Red Clash (Kaneko)", MACHINE_NO_SOUND | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
|
||||
GAME( 1982, sraider, 0, sraider, sraider, redclash_state, 0, ROT270, "Universal", "Space Raider", MACHINE_SUPPORTS_SAVE )
|
||||
|
@ -10,67 +10,119 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
class ladybug_state : public driver_device
|
||||
#include "video/ladybug.h"
|
||||
|
||||
|
||||
class ladybug_base_state : public driver_device
|
||||
{
|
||||
protected:
|
||||
using driver_device::driver_device;
|
||||
|
||||
void palette_init_common(palette_device &palette, const uint8_t *color_prom, int r_bit0, int r_bit1, int g_bit0, int g_bit1, int b_bit0, int b_bit1);
|
||||
};
|
||||
|
||||
|
||||
// ladybug platform
|
||||
class ladybug_state : public ladybug_base_state
|
||||
{
|
||||
public:
|
||||
ladybug_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_colorram(*this, "colorram"),
|
||||
m_decrypted_opcodes(*this, "decrypted_opcodes"),
|
||||
m_port_dsw0(*this, "DSW0"),
|
||||
m_p1_control(*this, "CONTP1"),
|
||||
m_p2_control(*this, "CONTP2")
|
||||
ladybug_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: ladybug_base_state(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_video(*this, "video")
|
||||
, m_port_dsw0(*this, "DSW0")
|
||||
, m_p1_control(*this, "CONTP1")
|
||||
, m_p2_control(*this, "CONTP2")
|
||||
{ }
|
||||
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p1_control_r);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(ladybug_p2_control_r);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(coin1_inserted);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(coin2_inserted);
|
||||
DECLARE_DRIVER_INIT(dorodon);
|
||||
void dorodon(machine_config &config);
|
||||
void ladybug(machine_config &config);
|
||||
|
||||
protected:
|
||||
DECLARE_WRITE8_MEMBER(ladybug_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(ladybug_colorram_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_grid_tile_info);
|
||||
virtual void machine_start() override;
|
||||
virtual void video_start() override;
|
||||
DECLARE_PALETTE_INIT(ladybug);
|
||||
uint32_t screen_update_ladybug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void palette_init_common( palette_device &palette, const uint8_t *color_prom,
|
||||
int r_bit0, int r_bit1, int g_bit0, int g_bit1, int b_bit0, int b_bit1 );
|
||||
|
||||
void decrypted_opcodes_map(address_map &map);
|
||||
void ladybug_map(address_map &map);
|
||||
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
required_shared_ptr<uint8_t> m_spriteram;
|
||||
|
||||
/* devices */
|
||||
private:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<ladybug_video_device> m_video;
|
||||
|
||||
/* video-related */
|
||||
tilemap_t *m_bg_tilemap;
|
||||
required_ioport m_port_dsw0;
|
||||
required_ioport m_p1_control;
|
||||
required_ioport m_p2_control;
|
||||
};
|
||||
|
||||
|
||||
// ladybug plus program decryption
|
||||
class dorodon_state : public ladybug_state
|
||||
{
|
||||
public:
|
||||
dorodon_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: ladybug_state(mconfig, type, tag)
|
||||
, m_decrypted_opcodes(*this, "decrypted_opcodes")
|
||||
{ }
|
||||
|
||||
DECLARE_DRIVER_INIT(dorodon);
|
||||
void dorodon(machine_config &config);
|
||||
|
||||
protected:
|
||||
void decrypted_opcodes_map(address_map &map);
|
||||
|
||||
private:
|
||||
optional_shared_ptr<uint8_t> m_colorram;
|
||||
optional_shared_ptr<uint8_t> m_decrypted_opcodes;
|
||||
required_shared_ptr<uint8_t> m_decrypted_opcodes;
|
||||
};
|
||||
|
||||
optional_ioport m_port_dsw0;
|
||||
optional_ioport m_p1_control;
|
||||
optional_ioport m_p2_control;
|
||||
|
||||
// graphics from ladybug, stars from zerohour, plus grid layer
|
||||
class sraider_state : public ladybug_base_state
|
||||
{
|
||||
public:
|
||||
sraider_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: ladybug_base_state(mconfig, type, tag)
|
||||
, m_grid_data(*this, "grid_data")
|
||||
, m_palette(*this, "palette")
|
||||
, m_gfxdecode(*this, "gfxdecode")
|
||||
, m_video(*this, "video")
|
||||
, m_stars(*this, "stars")
|
||||
{ }
|
||||
|
||||
void sraider(machine_config &config);
|
||||
|
||||
protected:
|
||||
DECLARE_READ8_MEMBER(sraider_8005_r);
|
||||
DECLARE_WRITE8_MEMBER(sraider_misc_w);
|
||||
DECLARE_WRITE8_MEMBER(sraider_io_w);
|
||||
DECLARE_PALETTE_INIT(sraider);
|
||||
DECLARE_WRITE_LINE_MEMBER(screen_vblank_sraider);
|
||||
TILE_GET_INFO_MEMBER(get_grid_tile_info);
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
uint32_t screen_update_sraider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void sraider_cpu1_map(address_map &map);
|
||||
void sraider_cpu2_io_map(address_map &map);
|
||||
void sraider_cpu2_map(address_map &map);
|
||||
|
||||
private:
|
||||
required_shared_ptr<uint8_t> m_grid_data;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<ladybug_video_device> m_video;
|
||||
required_device<zerohour_stars_device> m_stars;
|
||||
|
||||
tilemap_t *m_grid_tilemap;
|
||||
|
||||
uint8_t m_grid_color;
|
||||
uint8_t m_sraider_0x30;
|
||||
uint8_t m_sraider_0x38;
|
||||
uint8_t m_weird_value[8];
|
||||
};
|
||||
|
||||
#endif // MAME_INCLUDES_LADYBUG_H
|
||||
|
@ -10,87 +10,60 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "includes/ladybug.h"
|
||||
#include "video/ladybug.h"
|
||||
|
||||
class redclash_state : public ladybug_state
|
||||
|
||||
// redclash/zerohour
|
||||
class redclash_state : public driver_device
|
||||
{
|
||||
public:
|
||||
redclash_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: ladybug_state(mconfig, type, tag)
|
||||
, m_grid_data(*this, "grid_data")
|
||||
, m_sub(*this, "sub")
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_videoram(*this, "videoram")
|
||||
, m_spriteram(*this, "spriteram")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_palette(*this, "palette")
|
||||
, m_gfxdecode(*this, "gfxdecode")
|
||||
, m_stars(*this, "stars")
|
||||
{ }
|
||||
|
||||
uint8_t m_grid_color;
|
||||
int m_star_speed;
|
||||
uint8_t m_stars_enable;
|
||||
uint8_t m_stars_speed;
|
||||
uint32_t m_stars_state;
|
||||
uint16_t m_stars_offset;
|
||||
uint8_t m_stars_count;
|
||||
|
||||
tilemap_t *m_grid_tilemap; // ladybug
|
||||
|
||||
optional_shared_ptr<uint8_t> m_grid_data;
|
||||
optional_device<cpu_device> m_sub;
|
||||
tilemap_t *m_fg_tilemap; // redclash
|
||||
int m_gfxbank; // redclash only
|
||||
|
||||
/* misc */
|
||||
uint8_t m_sound_low;
|
||||
uint8_t m_sound_high;
|
||||
uint8_t m_weird_value[8];
|
||||
uint8_t m_sraider_0x30;
|
||||
uint8_t m_sraider_0x38;
|
||||
|
||||
DECLARE_READ8_MEMBER(sraider_sound_low_r);
|
||||
DECLARE_READ8_MEMBER(sraider_sound_high_r);
|
||||
DECLARE_WRITE8_MEMBER(sraider_sound_low_w);
|
||||
DECLARE_WRITE8_MEMBER(sraider_sound_high_w);
|
||||
DECLARE_READ8_MEMBER(sraider_8005_r);
|
||||
DECLARE_WRITE8_MEMBER(sraider_misc_w);
|
||||
DECLARE_WRITE8_MEMBER(sraider_io_w);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(left_coin_inserted);
|
||||
DECLARE_INPUT_CHANGED_MEMBER(right_coin_inserted);
|
||||
DECLARE_DRIVER_INIT(redclash);
|
||||
DECLARE_MACHINE_START(sraider);
|
||||
DECLARE_MACHINE_RESET(sraider);
|
||||
DECLARE_VIDEO_START(sraider);
|
||||
DECLARE_PALETTE_INIT(sraider);
|
||||
DECLARE_MACHINE_START(redclash);
|
||||
DECLARE_MACHINE_RESET(redclash);
|
||||
DECLARE_VIDEO_START(redclash);
|
||||
DECLARE_PALETTE_INIT(redclash);
|
||||
uint32_t screen_update_sraider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_redclash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_WRITE_LINE_MEMBER(screen_vblank_sraider);
|
||||
void redclash(machine_config &config);
|
||||
void zerohour(machine_config &config);
|
||||
|
||||
protected:
|
||||
DECLARE_WRITE_LINE_MEMBER(screen_vblank_redclash);
|
||||
DECLARE_WRITE8_MEMBER( redclash_videoram_w );
|
||||
DECLARE_WRITE8_MEMBER( redclash_gfxbank_w );
|
||||
DECLARE_WRITE8_MEMBER( redclash_flipscreen_w );
|
||||
DECLARE_WRITE8_MEMBER(redclash_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(redclash_gfxbank_w);
|
||||
DECLARE_WRITE8_MEMBER(redclash_flipscreen_w);
|
||||
DECLARE_WRITE8_MEMBER(irqack_w);
|
||||
DECLARE_WRITE8_MEMBER(redclash_star_reset_w);
|
||||
template <unsigned B> DECLARE_WRITE8_MEMBER(redclash_star_w);
|
||||
DECLARE_PALETTE_INIT(redclash);
|
||||
TILE_GET_INFO_MEMBER(get_fg_tile_info);
|
||||
|
||||
DECLARE_WRITE8_MEMBER( redclash_star0_w );
|
||||
DECLARE_WRITE8_MEMBER( redclash_star1_w );
|
||||
DECLARE_WRITE8_MEMBER( redclash_star2_w );
|
||||
DECLARE_WRITE8_MEMBER( redclash_star_reset_w );
|
||||
DECLARE_WRITE8_MEMBER( irqack_w );
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
uint32_t screen_update_redclash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void redclash_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void redclash_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
/* sraider uses the zerohour star generator board */
|
||||
void redclash_set_stars_enable(uint8_t on);
|
||||
void redclash_update_stars_state();
|
||||
void redclash_set_stars_speed(uint8_t speed);
|
||||
void redclash_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t palette_offset, uint8_t sraider, uint8_t firstx, uint8_t lastx);
|
||||
void redclash_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void redclash_draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect );
|
||||
void zerohour(machine_config &config);
|
||||
void sraider(machine_config &config);
|
||||
void redclash(machine_config &config);
|
||||
void redclash_map(address_map &map);
|
||||
void sraider_cpu1_map(address_map &map);
|
||||
void sraider_cpu2_io_map(address_map &map);
|
||||
void sraider_cpu2_map(address_map &map);
|
||||
void zerohour_map(address_map &map);
|
||||
|
||||
private:
|
||||
required_shared_ptr<uint8_t> m_videoram;
|
||||
required_shared_ptr<uint8_t> m_spriteram;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<zerohour_stars_device> m_stars;
|
||||
|
||||
tilemap_t *m_fg_tilemap;
|
||||
int m_gfxbank; // redclash only
|
||||
};
|
||||
|
||||
#endif // MAME_INCLUDES_REDCLASH_H
|
||||
|
@ -9,9 +9,232 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "video/resnet.h"
|
||||
#include "ladybug.h"
|
||||
#include "includes/ladybug.h"
|
||||
|
||||
#include "video/resnet.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE(LADYBUG_VIDEO, ladybug_video_device, "ladybug_video", "Lady Bug/Space Raider background")
|
||||
DEFINE_DEVICE_TYPE(ZEROHOUR_STARS, zerohour_stars_device, "zerohour_stars", "Zero Hour/Red Clash/Space Raider starfield")
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
ladybug/sraider video
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
ladybug_video_device::ladybug_video_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, LADYBUG_VIDEO, tag, owner, clock)
|
||||
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
|
||||
, m_spr_ram()
|
||||
, m_bg_ram()
|
||||
, m_bg_tilemap(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ladybug_video_device::bg_w)
|
||||
{
|
||||
m_bg_ram[offset & 0x07ff] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset & 0x03ff);
|
||||
}
|
||||
|
||||
void ladybug_video_device::draw(screen_device &screen, bitmap_ind16 &bitmap, rectangle const &cliprect, bool flip)
|
||||
{
|
||||
// TODO: confirm whether sraider hardware actually does this - not used by the game
|
||||
for (unsigned offs = 0; offs < 32; ++offs)
|
||||
{
|
||||
int const scroll = m_bg_ram[((offs & 0x03) << 5) | (offs >> 2)];
|
||||
m_bg_tilemap->set_scrollx(offs, flip ? -scroll : scroll);
|
||||
}
|
||||
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0);
|
||||
|
||||
for (int offs = 0x400 - (0x40 << 1); (0x40 << 1) <= offs; offs -= 0x40)
|
||||
{
|
||||
int i = 0;
|
||||
while ((0x40 > i) && m_spr_ram[offs + i])
|
||||
i += 4;
|
||||
|
||||
while (0 < i)
|
||||
{
|
||||
/*
|
||||
abccdddd eeeeeeee fffghhhh iiiiiiii
|
||||
|
||||
a enable?
|
||||
b size (0 = 8x8, 1 = 16x16)
|
||||
cc flip
|
||||
dddd y offset
|
||||
eeeeeeee sprite code (shift right 2 bits for 16x16 sprites)
|
||||
fff unknown
|
||||
g sprite bank
|
||||
hhhh color
|
||||
iiiiiiii x position
|
||||
*/
|
||||
i -= 4;
|
||||
bool const enable(m_spr_ram[offs + i] & 0x80);
|
||||
if (enable)
|
||||
{
|
||||
bool const big(m_spr_ram[offs + i] & 0x40);
|
||||
bool const xflip(m_spr_ram[offs + i] & 0x20);
|
||||
bool const yflip(m_spr_ram[offs + i] & 0x10);
|
||||
int const code(m_spr_ram[offs + i + 1] | (BIT(m_spr_ram[offs + i + 2], 4) << 8));
|
||||
int const color(m_spr_ram[offs + i + 2] & 0x0f);
|
||||
int const xpos(m_spr_ram[offs + i + 3]);
|
||||
int const ypos((offs >> 2) | (m_spr_ram[offs + i] & 0x0f));
|
||||
if (big) // 16x16
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, code >> 2, color, xflip, yflip, xpos, ypos - 8, 0);
|
||||
else // 8x8
|
||||
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, code, color, xflip, yflip, xpos, ypos, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ladybug_video_device::device_start()
|
||||
{
|
||||
m_spr_ram = std::make_unique<u8 []>(0x0400);
|
||||
m_bg_ram = std::make_unique<u8 []>(0x0800);
|
||||
std::fill_n(m_spr_ram.get(), 0x0800, 0);
|
||||
std::fill_n(m_bg_ram.get(), 0x0800, 0);
|
||||
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ladybug_video_device::get_bg_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_bg_tilemap->set_scroll_rows(32);
|
||||
m_bg_tilemap->set_transparent_pen(0);
|
||||
|
||||
save_pointer(NAME(m_spr_ram.get()), 0x0400);
|
||||
save_pointer(NAME(m_bg_ram.get()), 0x0800);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(ladybug_video_device::get_bg_tile_info)
|
||||
{
|
||||
int const code = m_bg_ram[tile_index] + (BIT(m_bg_ram[0x0400 | tile_index], 3) << 8);
|
||||
int const color = m_bg_ram[0x0400 | tile_index] & 0x07;
|
||||
|
||||
SET_TILE_INFO_MEMBER(0, code, color, 0);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
zerohour/redclash/sraider stars
|
||||
|
||||
These functions emulate the star generator board
|
||||
All this comes from the schematics for Zero Hour
|
||||
|
||||
It has a 17-bit LFSR which has a period of 2^17-1 clocks
|
||||
(This is one pixel shy of "two screens" worth.)
|
||||
So, there are two starfields drawn on alternate frames
|
||||
These will scroll at a rate controlled by the speed register
|
||||
|
||||
I'm basically doing the same thing by drawing each
|
||||
starfield on alternate frames, and then offseting them
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
zerohour_stars_device::zerohour_stars_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
|
||||
: device_t(mconfig, ZEROHOUR_STARS, tag, owner, clock)
|
||||
, m_enable(0)
|
||||
, m_speed(0)
|
||||
, m_offset(0)
|
||||
, m_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
// This line can reset the LFSR to zero and disables the star generator
|
||||
void zerohour_stars_device::set_enable(bool on)
|
||||
{
|
||||
if (!m_enable && on)
|
||||
m_offset = 0;
|
||||
|
||||
m_enable = on ? 1 : 0;
|
||||
}
|
||||
|
||||
// This sets up which starfield to draw and the offset, to be called from screen_vblank_*()
|
||||
void zerohour_stars_device::update_state()
|
||||
{
|
||||
if (m_enable)
|
||||
{
|
||||
m_count = m_count ? 0 : 1;
|
||||
if (!m_count)
|
||||
{
|
||||
m_offset += ((m_speed * 2) - 0x09);
|
||||
m_offset %= 256 * 256;
|
||||
m_state = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_state = 0x1fc71;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the speed register (3 bits)
|
||||
void zerohour_stars_device::set_speed(u8 speed, u8 mask)
|
||||
{
|
||||
// 0 left/down fastest (-9/2 pix per frame)
|
||||
// 1 left/down faster (-7/2 pix per frame)
|
||||
// 2 left/down fast (-5/2 pix per frame)
|
||||
// 3 left/down medium (-3/2 pix per frame)
|
||||
// 4 left/down slow (-1/2 pix per frame)
|
||||
// 5 right/up slow (+1/2 pix per frame)
|
||||
// 6 right/up medium (+3/2 pix per frame)
|
||||
// 7 right/up fast (+5/2 pix per frame)
|
||||
m_speed = (m_speed & ~mask) | (speed & mask);
|
||||
}
|
||||
|
||||
// Draw the stars
|
||||
// Space Raider doesn't use the Va bit, and it is also set up to window the stars to a certain x range
|
||||
void zerohour_stars_device::draw(bitmap_ind16 &bitmap, rectangle const &cliprect, u8 pal_offs, bool has_va, u8 firstx, u8 lastx)
|
||||
{
|
||||
if (m_enable)
|
||||
{
|
||||
u32 state(m_state);
|
||||
for (int i = 0; (256 * 256) > i; ++i)
|
||||
{
|
||||
u8 const xloc((m_offset + i) & 0x00ff);
|
||||
u8 const yloc(((m_offset + i) >> 8) & 0x00ff);
|
||||
|
||||
bool const tempbit(!(state & 0x10000));
|
||||
bool const feedback((state & 0x00020) ? !tempbit : tempbit);
|
||||
|
||||
bool const hcond(BIT(xloc + 8, 4));
|
||||
bool const vcond(!has_va || BIT(yloc, 0));
|
||||
|
||||
if (cliprect.contains(xloc, yloc) && (hcond == vcond))
|
||||
{
|
||||
if (((state & 0x000ff) == 0x000ff) && !feedback && (xloc >= firstx) && (xloc <= lastx))
|
||||
bitmap.pix16(yloc, xloc) = pal_offs + ((state >> 9) & 0x1f);
|
||||
}
|
||||
|
||||
// update LFSR state
|
||||
state = ((state << 1) & 0x1fffe) | (feedback ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void zerohour_stars_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_enable));
|
||||
save_item(NAME(m_speed));
|
||||
save_item(NAME(m_state));
|
||||
save_item(NAME(m_offset));
|
||||
save_item(NAME(m_count));
|
||||
}
|
||||
|
||||
void zerohour_stars_device::device_reset()
|
||||
{
|
||||
m_enable = 0;
|
||||
m_speed = 0;
|
||||
m_state = 0;
|
||||
m_offset = 0;
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Convert the color PROMs into a more useable format.
|
||||
@ -30,9 +253,27 @@
|
||||
bit 0 -- inverter -- 470 ohm resistor -- RED
|
||||
|
||||
***************************************************************************/
|
||||
/***************************************************************************
|
||||
|
||||
void ladybug_state::palette_init_common( palette_device &palette, const uint8_t *color_prom,
|
||||
int r_bit0, int r_bit1, int g_bit0, int g_bit1, int b_bit0, int b_bit1 )
|
||||
Convert the color PROMs into a more useable format.
|
||||
|
||||
Lady Bug has a 32 bytes palette PROM and a 32 bytes sprite color lookup
|
||||
table PROM.
|
||||
The palette PROM is connected to the RGB output this way:
|
||||
|
||||
bit 7 -- inverter -- 220 ohm resistor -- BLUE
|
||||
-- inverter -- 220 ohm resistor -- GREEN
|
||||
-- inverter -- 220 ohm resistor -- RED
|
||||
-- inverter -- 470 ohm resistor -- BLUE
|
||||
-- unused
|
||||
-- inverter -- 470 ohm resistor -- GREEN
|
||||
-- unused
|
||||
bit 0 -- inverter -- 470 ohm resistor -- RED
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
void ladybug_base_state::palette_init_common(palette_device &palette, const uint8_t *color_prom,
|
||||
int r_bit0, int r_bit1, int g_bit0, int g_bit1, int b_bit0, int b_bit1)
|
||||
{
|
||||
static const int resistances[2] = { 470, 220 };
|
||||
double rweights[2], gweights[2], bweights[2];
|
||||
@ -92,24 +333,12 @@ void ladybug_state::palette_init_common( palette_device &palette, const uint8_t
|
||||
}
|
||||
|
||||
|
||||
PALETTE_INIT_MEMBER(ladybug_state,ladybug)
|
||||
PALETTE_INIT_MEMBER(ladybug_state, ladybug)
|
||||
{
|
||||
const uint8_t *color_prom = memregion("proms")->base();
|
||||
palette_init_common(palette, color_prom, 0, 5, 2, 6, 4, 7);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ladybug_state::ladybug_videoram_w)
|
||||
{
|
||||
m_videoram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(ladybug_state::ladybug_colorram_w)
|
||||
{
|
||||
m_colorram[offset] = data;
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(ladybug_state::flipscreen_w)
|
||||
{
|
||||
if (flip_screen() != state)
|
||||
@ -119,18 +348,57 @@ WRITE_LINE_MEMBER(ladybug_state::flipscreen_w)
|
||||
}
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(ladybug_state::get_bg_tile_info)
|
||||
uint32_t ladybug_state::screen_update_ladybug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int code = m_videoram[tile_index] + 32 * (m_colorram[tile_index] & 0x08);
|
||||
int color = m_colorram[tile_index] & 0x07;
|
||||
|
||||
SET_TILE_INFO_MEMBER(0, code, color, 0);
|
||||
bitmap.fill(0, cliprect);
|
||||
m_video->draw(screen, bitmap, cliprect, flip_screen());
|
||||
return 0;
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(ladybug_state::get_grid_tile_info)
|
||||
|
||||
PALETTE_INIT_MEMBER(sraider_state, sraider)
|
||||
{
|
||||
const uint8_t *color_prom = memregion("proms")->base();
|
||||
|
||||
// the resistor net may be probably different than Lady Bug
|
||||
palette_init_common(palette, color_prom, 3, 0, 5, 4, 7, 6);
|
||||
|
||||
// star colors
|
||||
for (int i = 0x20; i < 0x40; i++)
|
||||
{
|
||||
int bit0, bit1;
|
||||
int r, g, b;
|
||||
|
||||
// red component
|
||||
bit0 = ((i - 0x20) >> 3) & 0x01;
|
||||
bit1 = ((i - 0x20) >> 4) & 0x01;
|
||||
b = 0x47 * bit0 + 0x97 * bit1;
|
||||
|
||||
// green component
|
||||
bit0 = ((i - 0x20) >> 1) & 0x01;
|
||||
bit1 = ((i - 0x20) >> 2) & 0x01;
|
||||
g = 0x47 * bit0 + 0x97 * bit1;
|
||||
|
||||
// blue component
|
||||
bit0 = ((i - 0x20) >> 0) & 0x01;
|
||||
r = 0x47 * bit0;
|
||||
|
||||
palette.set_indirect_color(i, rgb_t(r, g, b));
|
||||
}
|
||||
|
||||
for (int i = 0x60; i < 0x80; i++)
|
||||
palette.set_pen_indirect(i, (i - 0x60) + 0x20);
|
||||
|
||||
// stationary part of grid
|
||||
palette.set_pen_indirect(0x81, 0x40);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(sraider_state::get_grid_tile_info)
|
||||
{
|
||||
if (tile_index < 512)
|
||||
{
|
||||
SET_TILE_INFO_MEMBER(3, tile_index, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
int temp = tile_index / 32;
|
||||
@ -139,82 +407,81 @@ TILE_GET_INFO_MEMBER(ladybug_state::get_grid_tile_info)
|
||||
}
|
||||
}
|
||||
|
||||
void ladybug_state::video_start()
|
||||
WRITE8_MEMBER(sraider_state::sraider_io_w)
|
||||
{
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ladybug_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_bg_tilemap->set_scroll_rows(32);
|
||||
m_bg_tilemap->set_transparent_pen(0);
|
||||
}
|
||||
// bit7 = flip
|
||||
// bit6 = grid red
|
||||
// bit5 = grid green
|
||||
// bit4 = grid blue
|
||||
// bit3 = enable stars
|
||||
// bit210 = stars speed/dir
|
||||
|
||||
void ladybug_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
{
|
||||
uint8_t *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = m_spriteram.bytes() - 2 * 0x40; offs >= 2 * 0x40; offs -= 0x40)
|
||||
if (flip_screen() != (data & 0x80))
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while (i < 0x40 && spriteram[offs + i] != 0)
|
||||
i += 4;
|
||||
|
||||
while (i > 0)
|
||||
{
|
||||
/*
|
||||
abccdddd eeeeeeee fffghhhh iiiiiiii
|
||||
|
||||
a enable?
|
||||
b size (0 = 8x8, 1 = 16x16)
|
||||
cc flip
|
||||
dddd y offset
|
||||
eeeeeeee sprite code (shift right 2 bits for 16x16 sprites)
|
||||
fff unknown
|
||||
g sprite bank
|
||||
hhhh color
|
||||
iiiiiiii x position
|
||||
*/
|
||||
i -= 4;
|
||||
|
||||
if (spriteram[offs + i] & 0x80)
|
||||
{
|
||||
if (spriteram[offs + i] & 0x40) /* 16x16 */
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
|
||||
(spriteram[offs + i + 1] >> 2) + 4 * (spriteram[offs + i + 2] & 0x10),
|
||||
spriteram[offs + i + 2] & 0x0f,
|
||||
spriteram[offs + i] & 0x20,spriteram[offs + i] & 0x10,
|
||||
spriteram[offs + i + 3],
|
||||
offs / 4 - 8 + (spriteram[offs + i] & 0x0f),0);
|
||||
else /* 8x8 */
|
||||
m_gfxdecode->gfx(2)->transpen(bitmap,cliprect,
|
||||
spriteram[offs + i + 1] + 16 * (spriteram[offs + i + 2] & 0x10),
|
||||
spriteram[offs + i + 2] & 0x0f,
|
||||
spriteram[offs + i] & 0x20,spriteram[offs + i] & 0x10,
|
||||
spriteram[offs + i + 3],
|
||||
offs / 4 + (spriteram[offs + i] & 0x0f),0);
|
||||
}
|
||||
}
|
||||
flip_screen_set(data & 0x80);
|
||||
machine().tilemap().mark_all_dirty();
|
||||
}
|
||||
|
||||
m_grid_color = data & 0x70;
|
||||
|
||||
m_stars->set_enable(BIT(data, 3));
|
||||
|
||||
// There must be a subtle clocking difference between
|
||||
// Space Raider and the other games using this star generator,
|
||||
// hence the -1 here
|
||||
m_stars->set_speed((data & 0x07) - 1, 0x07);
|
||||
}
|
||||
|
||||
uint32_t ladybug_state::screen_update_ladybug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
void sraider_state::video_start()
|
||||
{
|
||||
int offs;
|
||||
ladybug_base_state::video_start();
|
||||
|
||||
m_grid_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(sraider_state::get_grid_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_grid_tilemap->set_scroll_rows(32);
|
||||
m_grid_tilemap->set_transparent_pen(0);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(sraider_state::screen_vblank_sraider)/* update starfield position */
|
||||
{
|
||||
// falling edge
|
||||
if (!state)
|
||||
m_stars->update_state();
|
||||
}
|
||||
|
||||
uint32_t sraider_state::screen_update_sraider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// clear the bg bitmap
|
||||
bitmap.fill(0, cliprect);
|
||||
|
||||
for (offs = 0; offs < 32; offs++)
|
||||
{
|
||||
int sx = offs % 4;
|
||||
int sy = offs / 4;
|
||||
// draw the stars
|
||||
if (flip_screen())
|
||||
m_stars->draw(bitmap, cliprect, 0x60, false, 0x27, 0xff);
|
||||
else
|
||||
m_stars->draw(bitmap, cliprect, 0x60, false, 0x00, 0xd8);
|
||||
|
||||
if (flip_screen())
|
||||
m_bg_tilemap->set_scrollx(offs, -m_videoram[32 * sx + sy]);
|
||||
else
|
||||
m_bg_tilemap->set_scrollx(offs, m_videoram[32 * sx + sy]);
|
||||
// draw the gridlines
|
||||
m_palette->set_indirect_color(0x40, rgb_t(
|
||||
m_grid_color & 0x40 ? 0xff : 0,
|
||||
m_grid_color & 0x20 ? 0xff : 0,
|
||||
m_grid_color & 0x10 ? 0xff : 0));
|
||||
m_grid_tilemap->draw(screen, bitmap, cliprect, 0, flip_screen());
|
||||
|
||||
for (unsigned i = 0; i < 0x100; i++)
|
||||
{
|
||||
if (m_grid_data[i] != 0)
|
||||
{
|
||||
uint8_t x = i;
|
||||
int height = cliprect.max_y - cliprect.min_y + 1;
|
||||
|
||||
if (flip_screen())
|
||||
x = ~x;
|
||||
|
||||
bitmap.plot_box(x, cliprect.min_y, 1, height, 0x81);
|
||||
}
|
||||
}
|
||||
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
// now the chars/sprites
|
||||
m_video->draw(screen, bitmap, cliprect, flip_screen());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -100,44 +100,6 @@ PALETTE_INIT_MEMBER(redclash_state,redclash)
|
||||
palette.set_pen_indirect(i, (i - 0x60) + 0x20);
|
||||
}
|
||||
|
||||
PALETTE_INIT_MEMBER(redclash_state,sraider)
|
||||
{
|
||||
const uint8_t *color_prom = memregion("proms")->base();
|
||||
int i;
|
||||
|
||||
/* the resistor net may be probably different than Lady Bug */
|
||||
palette_init_common(palette, color_prom, 3, 0, 5, 4, 7, 6);
|
||||
|
||||
/* star colors */
|
||||
for (i = 0x20; i < 0x40; i++)
|
||||
{
|
||||
int bit0, bit1;
|
||||
int r, g, b;
|
||||
|
||||
/* red component */
|
||||
bit0 = ((i - 0x20) >> 3) & 0x01;
|
||||
bit1 = ((i - 0x20) >> 4) & 0x01;
|
||||
b = 0x47 * bit0 + 0x97 * bit1;
|
||||
|
||||
/* green component */
|
||||
bit0 = ((i - 0x20) >> 1) & 0x01;
|
||||
bit1 = ((i - 0x20) >> 2) & 0x01;
|
||||
g = 0x47 * bit0 + 0x97 * bit1;
|
||||
|
||||
/* blue component */
|
||||
bit0 = ((i - 0x20) >> 0) & 0x01;
|
||||
r = 0x47 * bit0;
|
||||
|
||||
palette.set_indirect_color(i, rgb_t(r, g, b));
|
||||
}
|
||||
|
||||
for (i = 0x60; i < 0x80; i++)
|
||||
palette.set_pen_indirect(i, (i - 0x60) + 0x20);
|
||||
|
||||
/* stationary part of grid */
|
||||
palette.set_pen_indirect(0x81, 0x40);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_MEMBER( redclash_state::redclash_videoram_w )
|
||||
{
|
||||
@ -159,38 +121,9 @@ WRITE8_MEMBER( redclash_state::redclash_flipscreen_w )
|
||||
flip_screen_set(data & 0x01);
|
||||
}
|
||||
|
||||
/*
|
||||
star_speed:
|
||||
0 = unused
|
||||
1 = unused
|
||||
2 = forward fast
|
||||
3 = forward medium
|
||||
4 = forward slow
|
||||
5 = backwards slow
|
||||
6 = backwards medium
|
||||
7 = backwards fast
|
||||
*/
|
||||
WRITE8_MEMBER( redclash_state::redclash_star0_w )
|
||||
{
|
||||
m_star_speed = (m_star_speed & ~1) | ((data & 1) << 0);
|
||||
redclash_set_stars_speed(m_star_speed);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( redclash_state::redclash_star1_w )
|
||||
{
|
||||
m_star_speed = (m_star_speed & ~2) | ((data & 1) << 1);
|
||||
redclash_set_stars_speed(m_star_speed);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( redclash_state::redclash_star2_w )
|
||||
{
|
||||
m_star_speed = (m_star_speed & ~4) | ((data & 1) << 2);
|
||||
redclash_set_stars_speed( m_star_speed);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( redclash_state::redclash_star_reset_w )
|
||||
{
|
||||
redclash_set_stars_enable(1);
|
||||
m_stars->set_enable(true);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(redclash_state::get_fg_tile_info)
|
||||
@ -201,13 +134,14 @@ TILE_GET_INFO_MEMBER(redclash_state::get_fg_tile_info)
|
||||
SET_TILE_INFO_MEMBER(0, code, color, 0);
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(redclash_state,redclash)
|
||||
|
||||
void redclash_state::video_start()
|
||||
{
|
||||
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(redclash_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(redclash_state::get_fg_tile_info), this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_fg_tilemap->set_transparent_pen(0);
|
||||
}
|
||||
|
||||
void redclash_state::redclash_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
|
||||
void redclash_state::redclash_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
uint8_t *spriteram = m_spriteram;
|
||||
int i, offs;
|
||||
@ -310,247 +244,19 @@ void redclash_state::redclash_draw_bullets( bitmap_ind16 &bitmap, const rectangl
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* These functions emulate the star generator board
|
||||
* All this comes from the schematics for Zero Hour
|
||||
*
|
||||
* It has a 17-bit LFSR which has a period of 2^17-1 clocks
|
||||
* (This is one pixel shy of "two screens" worth.)
|
||||
* So, there are two starfields drawn on alternate frames
|
||||
* These will scroll at a rate controlled by the speed register
|
||||
*
|
||||
* I'm basically doing the same thing by drawing each
|
||||
* starfield on alternate frames, and then offseting them
|
||||
*/
|
||||
|
||||
/* This line can reset the LFSR to zero and disables the star generator */
|
||||
void redclash_state::redclash_set_stars_enable(uint8_t on)
|
||||
{
|
||||
if ((m_stars_enable == 0) && (on == 1))
|
||||
{
|
||||
m_stars_offset = 0;
|
||||
}
|
||||
|
||||
m_stars_enable = on;
|
||||
}
|
||||
|
||||
/* This sets up which starfield to draw and the offset, */
|
||||
/* To be called from screen_vblank_*() */
|
||||
|
||||
void redclash_state::redclash_update_stars_state()
|
||||
{
|
||||
if (m_stars_enable == 0)
|
||||
return;
|
||||
|
||||
m_stars_count++;
|
||||
m_stars_count %= 2;
|
||||
|
||||
if (m_stars_count == 0)
|
||||
{
|
||||
m_stars_offset += ((m_stars_speed * 2) - 0x09);
|
||||
m_stars_offset %= 256 * 256;
|
||||
m_stars_state = 0;
|
||||
}
|
||||
else
|
||||
m_stars_state = 0x1fc71;
|
||||
}
|
||||
|
||||
/* Set the speed register (3 bits) */
|
||||
|
||||
/*
|
||||
* 0 left/down fastest (-9/2 pix per frame)
|
||||
* 1 left/down faster (-7/2 pix per frame)
|
||||
* 2 left/down fast (-5/2 pix per frame)
|
||||
* 3 left/down medium (-3/2 pix per frame)
|
||||
* 4 left/down slow (-1/2 pix per frame)
|
||||
* 5 right/up slow (+1/2 pix per frame)
|
||||
* 6 right/up medium (+3/2 pix per frame)
|
||||
* 7 right/up fast (+5/2 pix per frame)
|
||||
*/
|
||||
|
||||
void redclash_state::redclash_set_stars_speed(uint8_t speed )
|
||||
{
|
||||
m_stars_speed = speed;
|
||||
}
|
||||
|
||||
/* Draw the stars */
|
||||
|
||||
/* Space Raider doesn't use the Va bit, and it is also set up to */
|
||||
/* window the stars to a certain x range */
|
||||
|
||||
void redclash_state::redclash_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t palette_offset, uint8_t sraider, uint8_t firstx, uint8_t lastx )
|
||||
{
|
||||
int i;
|
||||
uint8_t tempbit, feedback, star_color, xloc, yloc;
|
||||
uint32_t state;
|
||||
uint8_t hcond, vcond;
|
||||
|
||||
if (m_stars_enable == 0)
|
||||
return;
|
||||
|
||||
state = m_stars_state;
|
||||
|
||||
for(i = 0; i < 256 * 256; i++)
|
||||
{
|
||||
xloc = (m_stars_offset + i) % 256;
|
||||
yloc = ((m_stars_offset + i) /256 ) % 256;
|
||||
|
||||
if ((state & 0x10000) == 0)
|
||||
tempbit = 1;
|
||||
else
|
||||
tempbit = 0;
|
||||
|
||||
if ((state & 0x00020) != 0)
|
||||
feedback = tempbit ^ 1;
|
||||
else
|
||||
feedback = tempbit ^ 0;
|
||||
|
||||
hcond = ((xloc + 8) & 0x10) >> 4;
|
||||
|
||||
// sraider doesn't have Va hooked up
|
||||
if (sraider)
|
||||
vcond = 1;
|
||||
else
|
||||
vcond = yloc & 0x01;
|
||||
|
||||
if (cliprect.contains(xloc, yloc))
|
||||
{
|
||||
if ((hcond ^ vcond) == 0)
|
||||
{
|
||||
/* enable condition */
|
||||
if (((state & 0x000ff) == 0x000ff) && (feedback == 0))
|
||||
{
|
||||
/* used by space raider */
|
||||
if ((xloc >= firstx) && (xloc <= lastx))
|
||||
{
|
||||
star_color = (state >> 9) & 0x1f;
|
||||
bitmap.pix16(yloc, xloc) = palette_offset + star_color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* update LFSR state */
|
||||
state = ((state << 1) & 0x1fffe) | feedback;
|
||||
}
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(redclash_state::screen_vblank_redclash)
|
||||
{
|
||||
// falling edge
|
||||
if (!state)
|
||||
redclash_update_stars_state();
|
||||
m_stars->update_state();
|
||||
}
|
||||
|
||||
uint32_t redclash_state::screen_update_redclash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
bitmap.fill(m_palette->black_pen(), cliprect);
|
||||
redclash_draw_stars(bitmap, cliprect, 0x60, 0, 0x00, 0xff);
|
||||
m_stars->draw(bitmap, cliprect, 0x60, true, 0x00, 0xff);
|
||||
redclash_draw_sprites(bitmap, cliprect);
|
||||
redclash_draw_bullets(bitmap, cliprect);
|
||||
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(redclash_state::sraider_io_w)
|
||||
{
|
||||
// bit7 = flip
|
||||
// bit6 = grid red
|
||||
// bit5 = grid green
|
||||
// bit4 = grid blue
|
||||
// bit3 = enable stars
|
||||
// bit210 = stars speed/dir
|
||||
|
||||
if (flip_screen() != (data & 0x80))
|
||||
{
|
||||
flip_screen_set(data & 0x80);
|
||||
machine().tilemap().mark_all_dirty();
|
||||
}
|
||||
|
||||
m_grid_color = data & 0x70;
|
||||
|
||||
redclash_set_stars_enable((data & 0x08) >> 3);
|
||||
|
||||
/*
|
||||
* There must be a subtle clocking difference between
|
||||
* Space Raider and the other games using this star generator,
|
||||
* hence the -1 here
|
||||
*/
|
||||
|
||||
redclash_set_stars_speed((data & 0x07) - 1);
|
||||
}
|
||||
|
||||
VIDEO_START_MEMBER(redclash_state,sraider)
|
||||
{
|
||||
m_grid_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(redclash_state::get_grid_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_grid_tilemap->set_scroll_rows(32);
|
||||
m_grid_tilemap->set_transparent_pen(0);
|
||||
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(redclash_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
|
||||
m_bg_tilemap->set_scroll_rows(32);
|
||||
m_bg_tilemap->set_transparent_pen(0);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER(redclash_state::screen_vblank_sraider)/* update starfield position */
|
||||
{
|
||||
// falling edge
|
||||
if (!state)
|
||||
redclash_update_stars_state();
|
||||
}
|
||||
|
||||
uint32_t redclash_state::screen_update_sraider(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
// this part is boilerplate from ladybug, not sure if hardware does this,
|
||||
// since it's not used
|
||||
|
||||
int offs;
|
||||
int i;
|
||||
|
||||
for (offs = 0; offs < 32; offs++)
|
||||
{
|
||||
int sx = offs % 4;
|
||||
int sy = offs / 4;
|
||||
|
||||
if (flip_screen())
|
||||
m_bg_tilemap->set_scrollx(offs, -m_videoram[32 * sx + sy]);
|
||||
else
|
||||
m_bg_tilemap->set_scrollx(offs, m_videoram[32 * sx + sy]);
|
||||
}
|
||||
|
||||
// clear the bg bitmap
|
||||
bitmap.fill(0, cliprect);
|
||||
|
||||
// draw the stars
|
||||
if (flip_screen())
|
||||
redclash_draw_stars(bitmap, cliprect, 0x60, 1, 0x27, 0xff);
|
||||
else
|
||||
redclash_draw_stars(bitmap, cliprect, 0x60, 1, 0x00, 0xd8);
|
||||
|
||||
// draw the gridlines
|
||||
m_palette->set_indirect_color(0x40, rgb_t(m_grid_color & 0x40 ? 0xff : 0,
|
||||
m_grid_color & 0x20 ? 0xff : 0,
|
||||
m_grid_color & 0x10 ? 0xff : 0));
|
||||
m_grid_tilemap->draw(screen, bitmap, cliprect, 0, flip_screen());
|
||||
|
||||
for (i = 0; i < 0x100; i++)
|
||||
{
|
||||
if (m_grid_data[i] != 0)
|
||||
{
|
||||
uint8_t x = i;
|
||||
int height = cliprect.max_y - cliprect.min_y + 1;
|
||||
|
||||
if (flip_screen())
|
||||
x = ~x;
|
||||
|
||||
bitmap.plot_box(x, cliprect.min_y, 1, height, 0x81);
|
||||
}
|
||||
}
|
||||
|
||||
// now the chars
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, flip_screen());
|
||||
|
||||
// now the sprites
|
||||
draw_sprites(bitmap, cliprect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user