Some work towards flower.cpp, nw

This commit is contained in:
angelosa 2016-09-19 19:40:35 +02:00
parent 74115791b1
commit 3c772ce3cb

View File

@ -80,17 +80,153 @@ class flower_state : public driver_device
{
public:
flower_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
: driver_device(mconfig, type, tag),
m_palette(*this, "palette"),
m_gfxdecode(*this, "gfxdecode"),
m_txvram(*this, "txvram"),
m_bgvram(*this, "bgvram"),
m_fgvram(*this, "fgvram")
{ }
required_device<palette_device> m_palette;
required_device<gfxdecode_device> m_gfxdecode;
required_shared_ptr<UINT8> m_txvram;
required_shared_ptr<UINT8> m_bgvram;
required_shared_ptr<UINT8> m_fgvram;
UINT32 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 flower_state::legacy_tx_draw(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
gfx_element *gfx_0 = m_gfxdecode->gfx(0);
int count;
for (count=0;count<32*32;count++)
{
int x = count % 32;
int y = count / 32;
UINT8 tile = m_txvram[count];
UINT8 attr = m_txvram[count+0x400];
if(attr & 0x03) // debug
attr = machine().rand() & 0xfc;
gfx_0->transpen(bitmap,cliprect,tile,attr >> 2,0,0,x*8,y*8,3);
}
for (count=0;count<4*32;count++)
{
int x = count / 32;
int y = count % 32;
UINT8 tile = m_txvram[count];
UINT8 attr = m_txvram[count+0x400];
if(attr & 0x03) // debug
attr = machine().rand() & 0xfc;
gfx_0->transpen(bitmap,cliprect,tile,attr >> 2,0,0,x*8+256,y*8,3);
}
}
void flower_state::legacy_layers_draw(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
gfx_element *gfx_1 = m_gfxdecode->gfx(1);
int count;
for (count=0;count<32*32;count++)
{
int x = count % 16;
int y = count / 16;
UINT8 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);
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);
}
}
UINT32 flower_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
legacy_layers_draw(bitmap,cliprect);
legacy_tx_draw(bitmap,cliprect);
return 0;
}
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(0xe000, 0xefff) AM_RAM AM_SHARE("txvram")
AM_RANGE(0xf000, 0xf1ff) AM_RAM AM_SHARE("bgvram")
AM_RANGE(0xf800, 0xf9ff) AM_RAM AM_SHARE("fgvram")
ADDRESS_MAP_END
static INPUT_PORTS_START( flower )
INPUT_PORTS_END
static const gfx_layout charlayout =
{
8,8,
RGN_FRAC(1,1),
2,
{ 0, 4 },
{ STEP4(0,1), STEP4(8,1) },
{ STEP8(0,16) },
8*8*2
};
static const gfx_layout tilelayout =
{
16,16,
RGN_FRAC(1,2),
4,
{ 0, 4, RGN_FRAC(1,2), RGN_FRAC(1,2)+4 },
{ STEP4(0,1), STEP4(8,1), STEP4(8*8*2,1), STEP4(8*8*2+8,1) },
{ STEP8(0,16), STEP8(8*8*4,16) },
16*16*2
};
static GFXDECODE_START( flower )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 )
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 16 )
GFXDECODE_ENTRY( "gfx3", 0, tilelayout, 0, 16 )
GFXDECODE_END
static MACHINE_CONFIG_START( flower, flower_state )
MCFG_CPU_ADD("maincpu",Z80,4000000)
MCFG_CPU_PROGRAM_MAP(shared_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", flower_state, irq0_line_hold)
MCFG_CPU_ADD("subcpu",Z80,4000000)
MCFG_CPU_PROGRAM_MAP(shared_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", flower_state, irq0_line_hold)
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_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", flower)
MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", 256)
MACHINE_CONFIG_END
@ -107,18 +243,18 @@ ROM_START( flower ) /* Komax version */
ROM_REGION( 0x2000, "gfx1", ROMREGION_INVERT ) /* tx layer */
ROM_LOAD( "10.13e", 0x0000, 0x2000, CRC(62f9b28c) SHA1(d57d06b99e72a4f68f197a5b6c042c926cc70ca0) ) // FIRST AND SECOND HALF IDENTICAL
ROM_REGION( 0x8000, "gfx2", ROMREGION_INVERT ) /* sprites */
ROM_LOAD( "14.19e", 0x0000, 0x2000, CRC(11b491c5) SHA1(be1c4a0fbe8fd4e124c21e0f700efa0428376691) )
ROM_LOAD( "13.17e", 0x2000, 0x2000, CRC(ea743986) SHA1(bbef4fd0f7d21cc89a52061fa50d7c2ea37287bd) )
ROM_LOAD( "12.16e", 0x4000, 0x2000, CRC(e3779f7f) SHA1(8e12d06b3cdc2fcb7b77cc35f8eca45544cc4873) )
ROM_LOAD( "11.14e", 0x6000, 0x2000, CRC(8801b34f) SHA1(256059fcd16b21e076db1c18fd9669128df1d658) )
ROM_REGION( 0x8000, "gfx3", ROMREGION_INVERT ) /* bg layers */
ROM_REGION( 0x8000, "gfx2", ROMREGION_INVERT ) /* bg layers */
ROM_LOAD( "8.10e", 0x0000, 0x2000, CRC(f85eb20f) SHA1(699edc970c359143dee6de2a97cc2a552454785b) )
ROM_LOAD( "6.7e", 0x2000, 0x2000, CRC(3e97843f) SHA1(4e4e5625dbf78eca97536b1428b2e49ad58c618f) )
ROM_LOAD( "9.12e", 0x4000, 0x2000, CRC(f1d9915e) SHA1(158e1cc8c402f9ae3906363d99f2b25c94c64212) )
ROM_LOAD( "15.9e", 0x6000, 0x2000, CRC(1cad9f72) SHA1(c38dbea266246ed4d47d12bdd8f9fae22a5f8bb8) )
ROM_REGION( 0x8000, "gfx3", ROMREGION_INVERT ) /* sprites */
ROM_LOAD( "14.19e", 0x0000, 0x2000, CRC(11b491c5) SHA1(be1c4a0fbe8fd4e124c21e0f700efa0428376691) )
ROM_LOAD( "13.17e", 0x2000, 0x2000, CRC(ea743986) SHA1(bbef4fd0f7d21cc89a52061fa50d7c2ea37287bd) )
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 */
@ -126,9 +262,9 @@ ROM_START( flower ) /* Komax version */
ROM_LOAD( "5.16a", 0x0000, 0x4000, CRC(42fa2853) SHA1(cc1e8b8231d6f27f48b05d59390e93ea1c1c0e4c) ) /* volume tables? */
ROM_REGION( 0x300, "proms", 0 ) /* RGB proms */
ROM_LOAD( "82s129.k1", 0x0200, 0x0100, CRC(d311ed0d) SHA1(1d530c874aecf93133d610ab3ce668548712913a) ) // r
ROM_LOAD( "82s129.k2", 0x0100, 0x0100, CRC(ababb072) SHA1(a9d46d12534c8662c6b54df94e96907f3a156968) ) // g
ROM_LOAD( "82s129.k3", 0x0000, 0x0100, CRC(5aab7b41) SHA1(8d44639c7c9f1ba34fe9c4e74c8a38b6453f7ac0) ) // b
ROM_LOAD( "82s129.k2", 0x0100, 0x0100, CRC(ababb072) SHA1(a9d46d12534c8662c6b54df94e96907f3a156968) ) // g
ROM_LOAD( "82s129.k1", 0x0200, 0x0100, CRC(d311ed0d) SHA1(1d530c874aecf93133d610ab3ce668548712913a) ) // r
ROM_REGION( 0x0520, "user1", 0 ) /* Other proms, (zoom table?) */
ROM_LOAD( "82s147.d7", 0x0000, 0x0200, CRC(f0dbb2a7) SHA1(03cd8fd41d6406894c6931e883a9ac6a4a4effc9) )
@ -150,18 +286,19 @@ ROM_START( flowerj ) /* Sega/Alpha version. Sega game number 834-5998 */
ROM_REGION( 0x2000, "gfx1", ROMREGION_INVERT ) /* tx layer */
ROM_LOAD( "10.13e", 0x0000, 0x2000, CRC(62f9b28c) SHA1(d57d06b99e72a4f68f197a5b6c042c926cc70ca0) ) // FIRST AND SECOND HALF IDENTICAL
ROM_REGION( 0x8000, "gfx2", ROMREGION_INVERT ) /* sprites */
ROM_LOAD( "14.19e", 0x0000, 0x2000, CRC(11b491c5) SHA1(be1c4a0fbe8fd4e124c21e0f700efa0428376691) )
ROM_LOAD( "13.17e", 0x2000, 0x2000, CRC(ea743986) SHA1(bbef4fd0f7d21cc89a52061fa50d7c2ea37287bd) )
ROM_LOAD( "12.16e", 0x4000, 0x2000, CRC(e3779f7f) SHA1(8e12d06b3cdc2fcb7b77cc35f8eca45544cc4873) )
ROM_LOAD( "11.14e", 0x6000, 0x2000, CRC(8801b34f) SHA1(256059fcd16b21e076db1c18fd9669128df1d658) )
ROM_REGION( 0x8000, "gfx3", ROMREGION_INVERT ) /* bg layers */
ROM_REGION( 0x8000, "gfx2", ROMREGION_INVERT ) /* bg layers */
ROM_LOAD( "8.10e", 0x0000, 0x2000, CRC(f85eb20f) SHA1(699edc970c359143dee6de2a97cc2a552454785b) )
ROM_LOAD( "6.7e", 0x2000, 0x2000, CRC(3e97843f) SHA1(4e4e5625dbf78eca97536b1428b2e49ad58c618f) )
ROM_LOAD( "9.12e", 0x4000, 0x2000, CRC(f1d9915e) SHA1(158e1cc8c402f9ae3906363d99f2b25c94c64212) )
ROM_LOAD( "7.9e", 0x6000, 0x2000, CRC(e350f36c) SHA1(f97204dc95b4000c268afc053a2333c1629e07d8) )
ROM_REGION( 0x8000, "gfx3", ROMREGION_INVERT ) /* sprites */
ROM_LOAD( "14.19e", 0x0000, 0x2000, CRC(11b491c5) SHA1(be1c4a0fbe8fd4e124c21e0f700efa0428376691) )
ROM_LOAD( "13.17e", 0x2000, 0x2000, CRC(ea743986) SHA1(bbef4fd0f7d21cc89a52061fa50d7c2ea37287bd) )
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 */
@ -169,9 +306,9 @@ ROM_START( flowerj ) /* Sega/Alpha version. Sega game number 834-5998 */
ROM_LOAD( "5.16a", 0x0000, 0x4000, CRC(42fa2853) SHA1(cc1e8b8231d6f27f48b05d59390e93ea1c1c0e4c) ) /* volume tables? */
ROM_REGION( 0x300, "proms", 0 ) /* RGB proms */
ROM_LOAD( "82s129.k1", 0x0200, 0x0100, CRC(d311ed0d) SHA1(1d530c874aecf93133d610ab3ce668548712913a) ) // r
ROM_LOAD( "82s129.k2", 0x0100, 0x0100, CRC(ababb072) SHA1(a9d46d12534c8662c6b54df94e96907f3a156968) ) // g
ROM_LOAD( "82s129.k3", 0x0000, 0x0100, CRC(5aab7b41) SHA1(8d44639c7c9f1ba34fe9c4e74c8a38b6453f7ac0) ) // b
ROM_LOAD( "82s129.k2", 0x0100, 0x0100, CRC(ababb072) SHA1(a9d46d12534c8662c6b54df94e96907f3a156968) ) // g
ROM_LOAD( "82s129.k1", 0x0200, 0x0100, CRC(d311ed0d) SHA1(1d530c874aecf93133d610ab3ce668548712913a) ) // r
ROM_REGION( 0x0520, "user1", 0 ) /* Other proms, (zoom table?) */
ROM_LOAD( "82s147.d7", 0x0000, 0x0200, CRC(f0dbb2a7) SHA1(03cd8fd41d6406894c6931e883a9ac6a4a4effc9) )