stlforce.cpp: switched to oki map instead of ROM_COPY (nw)

This commit is contained in:
Ivan Vangelista 2017-07-04 19:15:53 +02:00
parent a028481d1c
commit b62aa7b1b7
3 changed files with 67 additions and 81 deletions

View File

@ -13,13 +13,13 @@ inputs etc. by stephh
----------------------------------------
68000P12 processor
15mHZ cyrstal next to it
15mHZ crystal next to it
2 of these:
TPC 1020AFN-084c
32MHz crystal colse to this.
32MHz crystal close to this.
1 GAL
5 PROMS (16S25H)
@ -73,33 +73,31 @@ TO DO :
#include "includes/stlforce.h"
#include "cpu/m68000/m68000.h"
#include "machine/eepromser.h"
#include "sound/okim6295.h"
#include "screen.h"
#include "speaker.h"
WRITE16_MEMBER(stlforce_state::eeprom_w)
WRITE8_MEMBER(stlforce_state::eeprom_w)
{
if( ACCESSING_BITS_0_7 )
{
m_eeprom->di_write(data & 0x01);
m_eeprom->cs_write((data & 0x02) ? ASSERT_LINE : CLEAR_LINE );
m_eeprom->clk_write((data & 0x04) ? ASSERT_LINE : CLEAR_LINE );
}
m_eeprom->di_write(data & 0x01);
m_eeprom->cs_write((data & 0x02) ? ASSERT_LINE : CLEAR_LINE );
m_eeprom->clk_write((data & 0x04) ? ASSERT_LINE : CLEAR_LINE );
}
WRITE16_MEMBER(stlforce_state::oki_bank_w)
WRITE8_MEMBER(stlforce_state::oki_bank_w)
{
m_oki->set_rom_bank((data>>8) & 3);
if (m_okibank.found())
{
m_okibank->set_entry(data & 3);
}
}
static ADDRESS_MAP_START( stlforce_map, AS_PROGRAM, 16, stlforce_state )
AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x100000, 0x1007ff) AM_RAM_WRITE(stlforce_bg_videoram_w) AM_SHARE("bg_videoram")
AM_RANGE(0x100800, 0x100fff) AM_RAM_WRITE(stlforce_mlow_videoram_w) AM_SHARE("mlow_videoram")
AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(stlforce_mhigh_videoram_w) AM_SHARE("mhigh_videoram")
AM_RANGE(0x101800, 0x1027ff) AM_RAM_WRITE(stlforce_tx_videoram_w) AM_SHARE("tx_videoram")
AM_RANGE(0x100000, 0x1007ff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
AM_RANGE(0x100800, 0x100fff) AM_RAM_WRITE(mlow_videoram_w) AM_SHARE("mlow_videoram")
AM_RANGE(0x101000, 0x1017ff) AM_RAM_WRITE(mhigh_videoram_w) AM_SHARE("mhigh_videoram")
AM_RANGE(0x101800, 0x1027ff) AM_RAM_WRITE(tx_videoram_w) AM_SHARE("tx_videoram")
AM_RANGE(0x102800, 0x102fff) AM_RAM /* unknown / ram */
AM_RANGE(0x103000, 0x1033ff) AM_RAM AM_SHARE("bg_scrollram")
AM_RANGE(0x103400, 0x1037ff) AM_RAM AM_SHARE("mlow_scrollram")
@ -111,12 +109,17 @@ static ADDRESS_MAP_START( stlforce_map, AS_PROGRAM, 16, stlforce_state )
AM_RANGE(0x109000, 0x11ffff) AM_RAM
AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUT")
AM_RANGE(0x400002, 0x400003) AM_READ_PORT("SYSTEM")
AM_RANGE(0x400010, 0x400011) AM_WRITE(eeprom_w)
AM_RANGE(0x400012, 0x400013) AM_WRITE(oki_bank_w)
AM_RANGE(0x400010, 0x400011) AM_WRITE8(eeprom_w, 0x00ff)
AM_RANGE(0x400012, 0x400013) AM_WRITE8(oki_bank_w, 0xff00)
AM_RANGE(0x40001e, 0x40001f) AM_WRITENOP // sprites buffer commands
AM_RANGE(0x410000, 0x410001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff)
ADDRESS_MAP_END
static ADDRESS_MAP_START( twinbrat_oki_map, 0, 8, stlforce_state )
AM_RANGE(0x00000, 0x1ffff) AM_ROM
AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK("okibank")
ADDRESS_MAP_END
static INPUT_PORTS_START( stlforce )
PORT_START("INPUT")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
@ -193,7 +196,7 @@ static MACHINE_CONFIG_START( stlforce )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", M68000, 15000000)
MCFG_CPU_PROGRAM_MAP(stlforce_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", stlforce_state, irq4_line_hold)
MCFG_CPU_VBLANK_INT_DRIVER("screen", stlforce_state, irq4_line_hold)
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
@ -203,7 +206,7 @@ static MACHINE_CONFIG_START( stlforce )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 47*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(stlforce_state, screen_update_stlforce)
MCFG_SCREEN_UPDATE_DRIVER(stlforce_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", stlforce)
@ -213,7 +216,7 @@ static MACHINE_CONFIG_START( stlforce )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_OKIM6295_ADD("oki", XTAL_32MHz/32 , PIN7_HIGH)
MCFG_OKIM6295_ADD("oki", XTAL_32MHz/32, PIN7_HIGH)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END
@ -225,6 +228,9 @@ static MACHINE_CONFIG_DERIVED( twinbrat, stlforce )
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_VISIBLE_AREA(3*8, 45*8-1, 0*8, 30*8-1)
MCFG_DEVICE_MODIFY("oki")
MCFG_DEVICE_ADDRESS_MAP(0, twinbrat_oki_map)
MACHINE_CONFIG_END
ROM_START( stlforce )
@ -245,7 +251,7 @@ ROM_START( stlforce )
ROM_LOAD( "stlforce.u33", 0xc0000, 0x40000, CRC(19415cf3) SHA1(31490a1f3321558f82667b63f3963b2ec3fa0c59) )
/* only one bank */
ROM_REGION( 0x80000, "oki", 0 ) /* samples */
ROM_REGION( 0x80000, "oki", 0 ) /* samples, second half 0xff filled */
ROM_LOAD( "stlforce.u1", 0x00000, 0x80000, CRC(0a55edf1) SHA1(091f12e8110c62df22b370a2e710c930ba06e8ca) )
ROM_REGION16_BE( 0x80, "eeprom", 0 )
@ -309,21 +315,9 @@ ROM_START( twinbrat )
ROM_LOAD( "9.bin", 0x080000, 0x40000, CRC(13194d89) SHA1(95c35b6012f98a64630abb40fd55b24ff8a5e031) )
ROM_LOAD( "8.bin", 0x0c0000, 0x40000, CRC(79f14528) SHA1(9c07d9a9e59f69a525bbaec05d74eb8d21bb9563) )
ROM_REGION( 0x080000, "user1", 0 ) /* Samples */
ROM_REGION( 0x080000, "oki", 0 ) /* Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked */
ROM_LOAD( "1.bin", 0x00000, 0x80000, CRC(76296578) SHA1(04eca78abe60b283269464c0d12815579126ac08) )
/* $00000-$20000 stays the same in all sound banks, */
/* the second half of the bank is what gets switched */
ROM_REGION( 0x100000, "oki", 0 ) /* Samples */
ROM_COPY( "user1", 0x000000, 0x000000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x020000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x040000, 0x020000)
ROM_COPY( "user1", 0x020000, 0x060000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x080000, 0x020000)
ROM_COPY( "user1", 0x040000, 0x0a0000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x0c0000, 0x020000)
ROM_COPY( "user1", 0x060000, 0x0e0000, 0x020000)
ROM_REGION16_BE( 0x80, "eeprom", 0 )
ROM_LOAD( "eeprom-twinbrat.bin", 0x0000, 0x0080, CRC(9366263d) SHA1(ff5155498ed0b349ecc1ce98a39566b642201cf2) )
ROM_END
@ -345,33 +339,24 @@ ROM_START( twinbrata )
ROM_LOAD( "9.bin", 0x080000, 0x40000, CRC(13194d89) SHA1(95c35b6012f98a64630abb40fd55b24ff8a5e031) )
ROM_LOAD( "8.bin", 0x0c0000, 0x40000, CRC(79f14528) SHA1(9c07d9a9e59f69a525bbaec05d74eb8d21bb9563) )
ROM_REGION( 0x080000, "user1", 0 ) /* Samples */
ROM_REGION( 0x080000, "oki", 0 ) /* Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked */
ROM_LOAD( "1.bin", 0x00000, 0x80000, CRC(76296578) SHA1(04eca78abe60b283269464c0d12815579126ac08) )
/* $00000-$20000 stays the same in all sound banks, */
/* the second half of the bank is what gets switched */
ROM_REGION( 0x100000, "oki", 0 ) /* Samples */
ROM_COPY( "user1", 0x000000, 0x000000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x020000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x040000, 0x020000)
ROM_COPY( "user1", 0x020000, 0x060000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x080000, 0x020000)
ROM_COPY( "user1", 0x040000, 0x0a0000, 0x020000)
ROM_COPY( "user1", 0x000000, 0x0c0000, 0x020000)
ROM_COPY( "user1", 0x060000, 0x0e0000, 0x020000)
ROM_REGION16_BE( 0x80, "eeprom", 0 )
ROM_LOAD( "eeprom-twinbrat.bin", 0x0000, 0x0080, CRC(9366263d) SHA1(ff5155498ed0b349ecc1ce98a39566b642201cf2) )
ROM_END
DRIVER_INIT_MEMBER(stlforce_state,stlforce)
DRIVER_INIT_MEMBER(stlforce_state, stlforce)
{
m_sprxoffs = 0;
}
DRIVER_INIT_MEMBER(stlforce_state,twinbrat)
DRIVER_INIT_MEMBER(stlforce_state, twinbrat)
{
m_sprxoffs = 9;
m_okibank->configure_entries(0, 4, memregion("oki")->base(), 0x20000);
m_okibank->set_entry(0);
}

View File

@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
#include "sound/okim6295.h"
#include "machine/eepromser.h"
class stlforce_state : public driver_device
@ -9,7 +9,6 @@ public:
stlforce_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_eeprom(*this, "eeprom"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
@ -21,10 +20,10 @@ public:
m_mlow_scrollram(*this, "mlow_scrollram"),
m_mhigh_scrollram(*this, "mhigh_scrollram"),
m_vidattrram(*this, "vidattrram"),
m_spriteram(*this, "spriteram") { }
m_spriteram(*this, "spriteram"),
m_okibank(*this, "okibank") { }
required_device<cpu_device> m_maincpu;
required_device<okim6295_device> m_oki;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
@ -39,6 +38,8 @@ public:
required_shared_ptr<uint16_t> m_vidattrram;
required_shared_ptr<uint16_t> m_spriteram;
optional_memory_bank m_okibank;
tilemap_t *m_bg_tilemap;
tilemap_t *m_mlow_tilemap;
tilemap_t *m_mhigh_tilemap;
@ -46,22 +47,22 @@ public:
int m_sprxoffs;
DECLARE_WRITE16_MEMBER(stlforce_bg_videoram_w);
DECLARE_WRITE16_MEMBER(stlforce_mlow_videoram_w);
DECLARE_WRITE16_MEMBER(stlforce_mhigh_videoram_w);
DECLARE_WRITE16_MEMBER(stlforce_tx_videoram_w);
DECLARE_WRITE16_MEMBER(eeprom_w);
DECLARE_WRITE16_MEMBER(oki_bank_w);
DECLARE_WRITE16_MEMBER(bg_videoram_w);
DECLARE_WRITE16_MEMBER(mlow_videoram_w);
DECLARE_WRITE16_MEMBER(mhigh_videoram_w);
DECLARE_WRITE16_MEMBER(tx_videoram_w);
DECLARE_WRITE8_MEMBER(eeprom_w);
DECLARE_WRITE8_MEMBER(oki_bank_w);
DECLARE_DRIVER_INIT(twinbrat);
DECLARE_DRIVER_INIT(stlforce);
TILE_GET_INFO_MEMBER(get_stlforce_bg_tile_info);
TILE_GET_INFO_MEMBER(get_stlforce_mlow_tile_info);
TILE_GET_INFO_MEMBER(get_stlforce_mhigh_tile_info);
TILE_GET_INFO_MEMBER(get_stlforce_tx_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_mlow_tile_info);
TILE_GET_INFO_MEMBER(get_mhigh_tile_info);
TILE_GET_INFO_MEMBER(get_tx_tile_info);
virtual void video_start() override;
uint32_t screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
};

View File

@ -1,13 +1,13 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/* video/stlforce.c - see main driver for other notes */
/* video/stlforce.cpp - see main driver for other notes */
#include "emu.h"
#include "includes/stlforce.h"
/* background, appears to be the bottom layer */
TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_bg_tile_info)
TILE_GET_INFO_MEMBER(stlforce_state::get_bg_tile_info)
{
int tileno,colour;
@ -17,7 +17,7 @@ TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_bg_tile_info)
SET_TILE_INFO_MEMBER(0,tileno,colour,0);
}
WRITE16_MEMBER(stlforce_state::stlforce_bg_videoram_w)
WRITE16_MEMBER(stlforce_state::bg_videoram_w)
{
m_bg_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
@ -25,7 +25,7 @@ WRITE16_MEMBER(stlforce_state::stlforce_bg_videoram_w)
/* middle layer, low */
TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_mlow_tile_info)
TILE_GET_INFO_MEMBER(stlforce_state::get_mlow_tile_info)
{
int tileno,colour;
@ -38,7 +38,7 @@ TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_mlow_tile_info)
SET_TILE_INFO_MEMBER(0,tileno,colour,0);
}
WRITE16_MEMBER(stlforce_state::stlforce_mlow_videoram_w)
WRITE16_MEMBER(stlforce_state::mlow_videoram_w)
{
m_mlow_videoram[offset] = data;
m_mlow_tilemap->mark_tile_dirty(offset);
@ -46,7 +46,7 @@ WRITE16_MEMBER(stlforce_state::stlforce_mlow_videoram_w)
/* middle layer, high */
TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_mhigh_tile_info)
TILE_GET_INFO_MEMBER(stlforce_state::get_mhigh_tile_info)
{
int tileno,colour;
@ -59,7 +59,7 @@ TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_mhigh_tile_info)
SET_TILE_INFO_MEMBER(0,tileno,colour,0);
}
WRITE16_MEMBER(stlforce_state::stlforce_mhigh_videoram_w)
WRITE16_MEMBER(stlforce_state::mhigh_videoram_w)
{
m_mhigh_videoram[offset] = data;
m_mhigh_tilemap->mark_tile_dirty(offset);
@ -67,7 +67,7 @@ WRITE16_MEMBER(stlforce_state::stlforce_mhigh_videoram_w)
/* text layer, appears to be the top layer */
TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_tx_tile_info)
TILE_GET_INFO_MEMBER(stlforce_state::get_tx_tile_info)
{
int tileno,colour;
@ -81,7 +81,7 @@ TILE_GET_INFO_MEMBER(stlforce_state::get_stlforce_tx_tile_info)
SET_TILE_INFO_MEMBER(1,tileno,colour,0);
}
WRITE16_MEMBER(stlforce_state::stlforce_tx_videoram_w)
WRITE16_MEMBER(stlforce_state::tx_videoram_w)
{
m_tx_videoram[offset] = data;
m_tx_tilemap->mark_tile_dirty(offset);
@ -120,7 +120,7 @@ void stlforce_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
}
}
uint32_t stlforce_state::screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t stlforce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int i;
@ -167,17 +167,17 @@ uint32_t stlforce_state::screen_update_stlforce(screen_device &screen, bitmap_in
m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0);
m_mlow_tilemap->draw(screen, bitmap, cliprect, 0,0);
m_mhigh_tilemap->draw(screen, bitmap, cliprect, 0,0);
draw_sprites(bitmap,cliprect);
draw_sprites(bitmap, cliprect);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0,0);
return 0;
}
void stlforce_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_stlforce_bg_tile_info),this), TILEMAP_SCAN_COLS, 16,16,64,16);
m_mlow_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_stlforce_mlow_tile_info),this), TILEMAP_SCAN_COLS, 16,16,64,16);
m_mhigh_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_stlforce_mhigh_tile_info),this),TILEMAP_SCAN_COLS, 16,16,64,16);
m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_stlforce_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8,64,32);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, 16,16,64,16);
m_mlow_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_mlow_tile_info),this), TILEMAP_SCAN_COLS, 16,16,64,16);
m_mhigh_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_mhigh_tile_info),this),TILEMAP_SCAN_COLS, 16,16,64,16);
m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(stlforce_state::get_tx_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8,64,32);
m_mlow_tilemap->set_transparent_pen(0);
m_mhigh_tilemap->set_transparent_pen(0);