summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/flower.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/flower.cpp')
-rw-r--r--src/mame/drivers/flower.cpp169
1 files changed, 154 insertions, 15 deletions
diff --git a/src/mame/drivers/flower.cpp b/src/mame/drivers/flower.cpp
index 63bfbfa3289..3a9584f5040 100644
--- a/src/mame/drivers/flower.cpp
+++ b/src/mame/drivers/flower.cpp
@@ -1,9 +1,19 @@
// license:BSD-3-Clause
-// copyright-holders:David Haywood
+// copyright-holders:Angelo Salese
+/******************************************************************************
-// **** SKELETON DRIVER **** original removed due to unresolved licensing.
+ Flower (c) 1986 Komax
-/*
+ driver by Angelo Salese,
+ original "wiped off due of not anymore licenseable" driver by insideoutboy.
+
+ TODO:
+ - sprite zooming/sizes;
+ - some video glitches;
+ - $a000 outputs;
+ - sound, third z80 not hooked up;
+
+===============================================================================
Flower (c)1986 Komax (USA license)
(c)1986 Sega/Alpha (Sega game number 834-5998)
@@ -71,7 +81,9 @@ CHIP # POSITION TYPE
Video Green | 39 | 40 | Video Red
GND | 41 | 42 | GND
GND | 43 | 44 | GND
-*/
+
+******************************************************************************/
+
#include "emu.h"
#include "cpu/z80/z80.h"
@@ -82,22 +94,33 @@ class flower_state : public driver_device
public:
flower_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
m_palette(*this, "palette"),
m_gfxdecode(*this, "gfxdecode"),
m_txvram(*this, "txvram"),
m_bgvram(*this, "bgvram"),
- m_fgvram(*this, "fgvram")
+ m_fgvram(*this, "fgvram"),
+ m_workram(*this, "workram"),
+ m_bgscroll(*this, "bgscroll"),
+ m_fgscroll(*this, "fgscroll")
{ }
+ required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
required_device<gfxdecode_device> m_gfxdecode;
required_shared_ptr<uint8_t> m_txvram;
required_shared_ptr<uint8_t> m_bgvram;
required_shared_ptr<uint8_t> m_fgvram;
+ required_shared_ptr<uint8_t> m_workram;
+ required_shared_ptr<uint8_t> m_bgscroll;
+ required_shared_ptr<uint8_t> m_fgscroll;
+
+ DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void legacy_tx_draw(bitmap_ind16 &bitmap,const rectangle &cliprect);
void legacy_layers_draw(bitmap_ind16 &bitmap,const rectangle &cliprect);
+ void sprites_draw(bitmap_ind16 &bitmap,const rectangle &cliprect);
};
@@ -140,33 +163,75 @@ void flower_state::legacy_tx_draw(bitmap_ind16 &bitmap,const rectangle &cliprect
void flower_state::legacy_layers_draw(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
gfx_element *gfx_1 = m_gfxdecode->gfx(1);
+ int bg_ybase = m_bgscroll[0];
+ int fg_ybase = m_fgscroll[0];
int count;
-
- for (count=0;count<32*32;count++)
+
+ for (count=0;count<16*16;count++)
{
int x = count % 16;
int y = count / 16;
uint8_t tile, attr;
-
+
tile = m_bgvram[count];
attr = m_bgvram[count+0x100];
if(attr & 0xf) // debug
attr = machine().rand() & 0xf0;
- gfx_1->opaque(bitmap,cliprect, tile, attr >> 4, 0, 0, x*16, y*16);
-
+ gfx_1->opaque(bitmap,cliprect, tile, attr >> 4, 0, 0, x*16, (y*16 - bg_ybase) & 0xff);
+ }
+
+
+ for (count=0;count<16*16;count++)
+ {
+ int x = count % 16;
+ int y = count / 16;
+ uint8_t tile, attr;
+
tile = m_fgvram[count];
attr = m_fgvram[count+0x100];
if(attr & 0xf)
attr = machine().rand() & 0xf0;
- gfx_1->transpen(bitmap,cliprect, tile, attr >> 4, 0, 0, x*16, y*16, 15);
+ gfx_1->transpen(bitmap,cliprect, tile, attr >> 4, 0, 0, x*16, (y*16 - fg_ybase) & 0xff, 15);
+ }
+}
+
+/*
+ [0] YYYY YYYY Y offset
+ [1] YXoo oooo Flip Y/X, tile number
+ [2] ---- b--b tile bank select
+ [3] Xxxx Yyyy X size, X zoom, Y size, Y zoom
+ [4] xxxx xxxx X offset LSB
+ [5] XXXX XXXX X offset MSB
+ [6] cccc ---- color base
+ */
+void flower_state::sprites_draw(bitmap_ind16 &bitmap,const rectangle &cliprect)
+{
+ uint8_t *spr_ptr = &m_workram[0x1e08];
+ gfx_element *gfx_2 = m_gfxdecode->gfx(2);
+
+ for(int i=0;i<0x1fb;i+=8)
+ {
+ uint8_t tile = (spr_ptr[i+1] & 0x3f);
+ uint8_t color = spr_ptr[i+6] >> 4;
+ int x = (spr_ptr[i+4] | (spr_ptr[i+5]<<8))-55;
+ int y = 241-spr_ptr[i+0];
+ uint8_t attr = spr_ptr[i+2];
+ uint8_t fy = spr_ptr[i+1] & 0x80;
+ uint8_t fx = spr_ptr[i+1] & 0x40;
+
+ tile |= (attr & 1) << 6;
+ tile |= (attr & 8) << 4;
+ // TODO: size and zoom
+ gfx_2->transpen(bitmap,cliprect, tile, color, fx, fy, x, y, 15);
}
}
uint32_t flower_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
legacy_layers_draw(bitmap,cliprect);
+ sprites_draw(bitmap,cliprect);
legacy_tx_draw(bitmap,cliprect);
return 0;
}
@@ -175,12 +240,87 @@ static ADDRESS_MAP_START( shared_map, AS_PROGRAM, 8, flower_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0xc000, 0xdfff) AM_RAM AM_SHARE("workram")
AM_RANGE(0xa000, 0xa000) AM_WRITENOP
+ AM_RANGE(0xa100, 0xa100) AM_READ_PORT("P1")
+ AM_RANGE(0xa101, 0xa101) AM_READ_PORT("P2")
+ AM_RANGE(0xa102, 0xa102) AM_READ_PORT("DSW1")
+ AM_RANGE(0xa103, 0xa103) AM_READ_PORT("DSW2")
AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("txvram")
AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_SHARE("bgvram")
+ AM_RANGE(0xf200, 0xf200) AM_RAM AM_SHARE("bgscroll")
AM_RANGE(0xf800, 0xf9ff) AM_RAM AM_SHARE("fgvram")
+ AM_RANGE(0xfa00, 0xfa00) AM_RAM AM_SHARE("fgscroll")
ADDRESS_MAP_END
+INPUT_CHANGED_MEMBER(flower_state::coin_inserted)
+{
+ m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
+}
+
static INPUT_PORTS_START( flower )
+ PORT_START("P1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Laser")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Missile")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("P1 Cutter")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("P2")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_NAME("P2 Laser")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL PORT_NAME("P2 Missile")
+ PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL PORT_NAME("P2 Cutter")
+ PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
+
+ PORT_START("DSW1")
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, flower_state,coin_inserted, 0)
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
+ PORT_DIPNAME( 0x08, 0x08, "Energy Decrease" ) PORT_DIPLOCATION("SW2:4")
+ PORT_DIPSETTING( 0x08, "Slow" )
+ PORT_DIPSETTING( 0x00, "Fast" )
+ PORT_DIPNAME( 0x10, 0x10, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW2:5")
+ PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x20, 0x20, "Keep Weapons When Destroyed" ) PORT_DIPLOCATION("SW2:6") // check code at 0x74a2
+ PORT_DIPSETTING( 0x20, DEF_STR( No ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
+ PORT_DIPNAME( 0x40, 0x40, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7") // "Enemy Bullets"
+ PORT_DIPSETTING( 0x40, DEF_STR( Normal ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( Hard ) )
+ PORT_DIPNAME( 0x80, 0x80, "Shot Range" ) PORT_DIPLOCATION("SW2:8") // check code at 0x75f9
+ PORT_DIPSETTING( 0x80, "Short" )
+ PORT_DIPSETTING( 0x00, "Long" )
+
+ PORT_START("DSW2")
+ PORT_DIPNAME( 0x07, 0x05, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2,3")
+ PORT_DIPSETTING( 0x07, "1" )
+ PORT_DIPSETTING( 0x06, "2" )
+ PORT_DIPSETTING( 0x05, "3" )
+ PORT_DIPSETTING( 0x04, "4" )
+ PORT_DIPSETTING( 0x03, "5" )
+ PORT_DIPSETTING( 0x02, "6" )
+ PORT_DIPSETTING( 0x01, "7" )
+ PORT_DIPSETTING( 0x00, "Infinite (Cheat)")
+ PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:4,5")
+ PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) )
+ PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
+ PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) )
+ PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:6") // check code at 0x759f
+ PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
+ PORT_DIPSETTING( 0x20, DEF_STR( Cocktail ) )
+ PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
+ PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
+ PORT_DIPSETTING( 0x00, DEF_STR( On ) )
+ PORT_DIPNAME( 0x80, 0x80, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPSETTING( 0x80, "30k, then every 50k" )
+ PORT_DIPSETTING( 0x00, "50k, then every 80k" )
INPUT_PORTS_END
static const gfx_layout charlayout =
@@ -222,7 +362,7 @@ static MACHINE_CONFIG_START( flower, flower_state )
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_UPDATE_DRIVER(flower_state, screen_update)
- MCFG_SCREEN_RAW_PARAMS(XTAL_3_579545MHz*2, 442, 0, 288, 263, 16, 240) /* generic NTSC video timing at 256x224 */
+ MCFG_SCREEN_RAW_PARAMS(XTAL_3_579545MHz*2, 442, 0, 272, 263, 16, 240) /* generic NTSC video timing at 256x224 */
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", flower)
@@ -299,7 +439,6 @@ ROM_START( flowerj ) /* Sega/Alpha version. Sega game number 834-5998 */
ROM_LOAD( "12.16e", 0x4000, 0x2000, CRC(e3779f7f) SHA1(8e12d06b3cdc2fcb7b77cc35f8eca45544cc4873) )
ROM_LOAD( "11.14e", 0x6000, 0x2000, CRC(8801b34f) SHA1(256059fcd16b21e076db1c18fd9669128df1d658) )
-
ROM_REGION( 0x8000, "sound1", 0 )
ROM_LOAD( "4.12a", 0x0000, 0x8000, CRC(851ed9fd) SHA1(5dc048b612e45da529502bf33d968737a7b0a646) ) /* 8-bit samples */
@@ -319,5 +458,5 @@ ROM_START( flowerj ) /* Sega/Alpha version. Sega game number 834-5998 */
ROM_END
-GAME( 1986, flower, 0, flower, flower, driver_device, 0, ROT0, "Clarue (Komax license)", "Flower (US)", MACHINE_IS_SKELETON )
-GAME( 1986, flowerj, flower, flower, flower, driver_device, 0, ROT0, "Clarue (Sega / Alpha Denshi Co. license)", "Flower (Japan)", MACHINE_IS_SKELETON )
+GAME( 1986, flower, 0, flower, flower, driver_device, 0, ROT0, "Clarue (Komax license)", "Flower (US)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND|MACHINE_IMPERFECT_GRAPHICS )
+GAME( 1986, flowerj, flower, flower, flower, driver_device, 0, ROT0, "Clarue (Sega / Alpha Denshi Co. license)", "Flower (Japan)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND|MACHINE_IMPERFECT_GRAPHICS )