Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 26 additions & 40 deletions src/mame/seibu/feversoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ U089 MAX232 Dual EIA Driver/Receiver

#include "emu.h"

#include "sei25x_rise1x_spr.h"
#include "seibuspi_m.h"

#include "cpu/sh/sh7604.h"
Expand All @@ -99,16 +100,16 @@ class feversoc_state : public driver_device
m_mainram1(*this, "workram1"),
m_mainram2(*this, "workram2"),
m_nvram(*this, "nvram"),
m_spriteram(*this, "spriteram"),
m_spriteram(*this, "spriteram", 0x2000, ENDIANNESS_BIG),
m_in(*this, {"IN1", "IN0"}),
m_lamps(*this, "lamp%u", 1U),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_eeprom(*this, "eeprom"),
m_rtc(*this, "rtc"),
m_hopper(*this, "hopper"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
m_palette(*this, "palette"),
m_spritegen(*this, "spritegen")
{ }

void init_feversoc() ATTR_COLD;
Expand All @@ -119,6 +120,8 @@ class feversoc_state : public driver_device
virtual void machine_start() override ATTR_COLD;

private:
uint16_t spriteram_r(offs_t offset);
void spriteram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t in_r(offs_t offset);
void output_w(uint16_t data);
void output2_w(uint16_t data);
Expand All @@ -131,7 +134,7 @@ class feversoc_state : public driver_device
required_shared_ptr<uint32_t> m_mainram1;
required_shared_ptr<uint32_t> m_mainram2;
required_shared_ptr<uint32_t> m_nvram;
required_shared_ptr<uint32_t> m_spriteram;
memory_share_creator<uint16_t> m_spriteram;
required_ioport_array<2> m_in;
output_finder<7> m_lamps;

Expand All @@ -140,51 +143,29 @@ class feversoc_state : public driver_device
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<jrc6355e_device> m_rtc;
required_device<ticket_dispenser_device> m_hopper;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<sei25x_rise1x_device> m_spritegen;
};


uint32_t feversoc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->pen(0), cliprect); //black pen

for (int offs = (0x2000 / 4) - 2; offs >= 0; offs -= 2)
{
u32 spr_offs = (m_spriteram[offs + 0] & 0x3fff);
if (spr_offs == 0)
continue;
int sy = m_spriteram[offs + 1] & 0x01ff;
int sx = (m_spriteram[offs + 1] & 0x01ff0000) >> 16;
const u32 colour = (m_spriteram[offs + 0] & 0x003f0000) >> 16;
const u8 w = ((m_spriteram[offs + 0] & 0x07000000) >> 24) + 1;
const u8 h = ((m_spriteram[offs + 0] & 0x70000000) >> 28) + 1;
// TODO: flip sprites, unused?
// flip horizontal in bit 27
// flip vertical in bit 31

if (sx >= 0x180)
sx -= 0x200;

if (sy >= 0x180)
sy -= 0x200;

for (int dx = 0; dx < w; dx++)
{
for (int dy = 0; dy < h; dy++)
{
m_gfxdecode->gfx(0)->transpen(bitmap, cliprect,
spr_offs++, colour,
0, 0,
(sx + dx * 16), (sy + dy * 16),
0x3f);
}
}
}
m_spritegen->draw_sprites(screen, bitmap, cliprect, m_spriteram, m_spriteram.bytes());

return 0;
}

uint16_t feversoc_state::spriteram_r(offs_t offset)
{
return m_spriteram[offset];
}

void feversoc_state::spriteram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
COMBINE_DATA(&m_spriteram[offset]);
}

uint16_t feversoc_state::in_r(offs_t offset)
{
Expand Down Expand Up @@ -227,7 +208,7 @@ void feversoc_state::main_map(address_map &map)
map(0x02000000, 0x0202ffff).ram().share(m_mainram1); //work ram
map(0x02030000, 0x02033fff).ram().share(m_nvram);
map(0x02034000, 0x0203dfff).ram().share(m_mainram2); //work ram
map(0x0203e000, 0x0203ffff).ram().share(m_spriteram);
map(0x0203e000, 0x0203ffff).rw(FUNC(feversoc_state::spriteram_r), FUNC(feversoc_state::spriteram_w));
map(0x06000000, 0x06000001).w(FUNC(feversoc_state::output_w));
map(0x06000002, 0x06000003).w(FUNC(feversoc_state::output2_w));
map(0x06000006, 0x06000007).w(FUNC(feversoc_state::irq_ack_w));
Expand Down Expand Up @@ -324,9 +305,14 @@ void feversoc_state::feversoc(machine_config &config)
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(feversoc_state::screen_vblank));

GFXDECODE(config, m_gfxdecode, m_palette, gfx_feversoc);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x1000);

SEI25X_RISE1X(config, m_spritegen, 0, m_palette, gfx_feversoc);
m_spritegen->set_screen("screen");
m_spritegen->set_pix_raw_shift(6);
m_spritegen->set_pri_raw_shift(14);
m_spritegen->set_transpen(63);

/* sound hardware */
SPEAKER(config, "mono").front_center();
OKIM6295(config, m_oki, MASTER_CLOCK / 16, okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "mono", 0.6); //pin 7 & frequency not verified (clock should be 28,6363 / n)
Expand All @@ -353,7 +339,7 @@ ROM_START( feversoc )
ROM_LOAD16_BYTE( "prog0.u0139", 0x00001, 0x20000, CRC(fa699503) SHA1(96a834d4f7d5b764aa51db745afc2cd9a7c9783d) )
ROM_LOAD16_BYTE( "prog1.u0140", 0x00000, 0x20000, CRC(fd4d7943) SHA1(d7d782f878656bc79d70589f9df2cbcfff0adb5e) )

ROM_REGION( 0x600000, "sprites", 0) /* text */
ROM_REGION( 0x600000, "sprites", 0) /* sprites */
ROM_LOAD("obj1.u011", 0x000000, 0x200000, CRC(d8c8dde7) SHA1(3ef815fb1e21a0bd907ee835bc7a32d80f6a9d28) )
ROM_LOAD("obj2.u012", 0x200000, 0x200000, CRC(8e93bfda) SHA1(3b4740cefb164efc320fb69f58e8800d2646fea6) )
ROM_LOAD("obj3.u013", 0x400000, 0x200000, CRC(8c8c6e8b) SHA1(bed4990d6eebb7aefa200ad2bed9b7e71e6bd064) )
Expand Down
18 changes: 2 additions & 16 deletions src/mame/seibu/r2dx_v33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,14 +792,7 @@ void r2dx_v33_state::rdx_v33(machine_config &config)
screen.set_visarea(0*8, 40*8-1, 0, 30*8-1);
screen.set_screen_update(FUNC(r2dx_v33_state::screen_update));

GFXDECODE(config, m_gfxdecode, m_palette, r2dx_v33_state::gfx_raiden2);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);

seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(r2dx_v33_state::tilemap_enable_w));
crtc.layer_scroll_callback().set(FUNC(r2dx_v33_state::tile_scroll_w));

BUFFERED_SPRITERAM16(config, m_spriteram);
base_video(config);

/* sound hardware */
SPEAKER(config, "mono").front_center();
Expand Down Expand Up @@ -828,14 +821,7 @@ void nzeroteam_state::nzerotea(machine_config &config)
screen.set_visarea(0*8, 40*8-1, 0, 32*8-1);
screen.set_screen_update(FUNC(nzeroteam_state::screen_update));

GFXDECODE(config, m_gfxdecode, m_palette, nzeroteam_state::gfx_raiden2);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);

seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(nzeroteam_state::tilemap_enable_w));
crtc.layer_scroll_callback().set(FUNC(nzeroteam_state::tile_scroll_w));

BUFFERED_SPRITERAM16(config, m_spriteram);
base_video(config);

/* sound hardware */
SPEAKER(config, "mono").front_center();
Expand Down
38 changes: 22 additions & 16 deletions src/mame/seibu/raiden2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,11 +1039,31 @@ static const gfx_layout tilelayout =
GFXDECODE_START( raiden2_state::gfx_raiden2 )
GFXDECODE_ENTRY( "chars", 0, charlayout, 0x700, 0x10 )
GFXDECODE_ENTRY( "tiles", 0, tilelayout, 0x400, 0x30 )
GFXDECODE_END

GFXDECODE_START( raiden2_state::gfx_raiden2_spr )
GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x4_packed_lsb, 0x000, 0x40 ) // really 64, but using the top bits for priority
GFXDECODE_END


/* MACHINE DRIVERS */
void raiden2_state::base_video(machine_config &config)
{
GFXDECODE(config, m_gfxdecode, m_palette, raiden2_state::gfx_raiden2);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);

seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(raiden2_state::tilemap_enable_w));
crtc.layer_scroll_callback().set(FUNC(raiden2_state::tile_scroll_w));

BUFFERED_SPRITERAM16(config, m_spriteram);

SEI25X_RISE1X(config, m_spritegen, 0, m_palette, raiden2_state::gfx_raiden2_spr);
m_spritegen->set_screen("screen");
m_spritegen->set_pix_raw_shift(4);
m_spritegen->set_pri_raw_shift(14);
m_spritegen->set_transpen(15);
}

void raiden2_state::raiden2(machine_config &config)
{
Expand All @@ -1064,14 +1084,7 @@ void raiden2_state::raiden2(machine_config &config)
screen.set_raw(XTAL(32'000'000)/4, 512, 0, 40*8, 282, 0, 30*8); /* hand-tuned to match ~55.47 */
screen.set_screen_update(FUNC(raiden2_state::screen_update));

GFXDECODE(config, m_gfxdecode, m_palette, raiden2_state::gfx_raiden2);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);

seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(raiden2_state::tilemap_enable_w));
crtc.layer_scroll_callback().set(FUNC(raiden2_state::tile_scroll_w));

BUFFERED_SPRITERAM16(config, m_spriteram);
base_video(config);

RAIDEN2COP(config, m_raiden2cop, 0);
m_raiden2cop->videoramout_cb().set(FUNC(raiden2_state::m_videoram_private_w));
Expand Down Expand Up @@ -1129,14 +1142,7 @@ void raiden2_state::zeroteam(machine_config &config)
screen.set_raw(XTAL(32'000'000)/4, 512, 0, 40*8, 282, 0, 32*8); /* hand-tuned to match ~55.47 */
screen.set_screen_update(FUNC(raiden2_state::screen_update));

GFXDECODE(config, m_gfxdecode, m_palette, raiden2_state::gfx_raiden2);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);

seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(raiden2_state::tilemap_enable_w));
crtc.layer_scroll_callback().set(FUNC(raiden2_state::tile_scroll_w));

BUFFERED_SPRITERAM16(config, m_spriteram);
base_video(config);

RAIDEN2COP(config, m_raiden2cop, 0);
m_raiden2cop->videoramout_cb().set(FUNC(raiden2_state::m_videoram_private_w));
Expand Down
18 changes: 11 additions & 7 deletions src/mame/seibu/raiden2.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#pragma once

#include "sei25x_rise1x_spr.h"
#include "seibu_crtc.h"
#include "seibucop.h"

Expand All @@ -29,6 +30,7 @@ class raiden2_state : public driver_device
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_screen(*this, "screen")
, m_spritegen(*this, "spritegen")
, m_mainbank(*this, "mainbank")
, m_raiden2cop(*this, "raiden2cop")

Expand All @@ -51,10 +53,10 @@ class raiden2_state : public driver_device
std::fill(std::begin(m_scrollvals), std::end(m_scrollvals), 0);
}

void raidendx(machine_config &config);
void xsedae(machine_config &config);
void zeroteam(machine_config &config);
void raiden2(machine_config &config);
void raidendx(machine_config &config) ATTR_COLD;
void xsedae(machine_config &config) ATTR_COLD;
void zeroteam(machine_config &config) ATTR_COLD;
void raiden2(machine_config &config) ATTR_COLD;

void init_raidendx();
void init_xsedae();
Expand All @@ -76,6 +78,7 @@ class raiden2_state : public driver_device
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
required_device<sei25x_rise1x_device> m_spritegen;
optional_memory_bank m_mainbank;
optional_device<raiden2cop_device> m_raiden2cop;

Expand All @@ -100,7 +103,7 @@ class raiden2_state : public driver_device

const s32 *m_cur_spri = nullptr; // cfg

bitmap_ind16 m_tile_bitmap, m_sprite_bitmap;
bitmap_ind16 m_tile_bitmap;

void sprite_prot_x_w(u16 data);
void sprite_prot_y_w(u16 data);
Expand All @@ -127,9 +130,8 @@ class raiden2_state : public driver_device

void bank_reset(int bgbank, int fgbank, int midbank, int txbank);

void draw_sprites(const rectangle &cliprect);

DECLARE_GFXDECODE_MEMBER(gfx_raiden2);
DECLARE_GFXDECODE_MEMBER(gfx_raiden2_spr);
TILE_GET_INFO_MEMBER(get_back_tile_info);
TILE_GET_INFO_MEMBER(get_mid_tile_info);
TILE_GET_INFO_MEMBER(get_fore_tile_info);
Expand All @@ -143,6 +145,8 @@ class raiden2_state : public driver_device

void zeroteam_sound_map(address_map &map) ATTR_COLD;

void base_video(machine_config &config) ATTR_COLD;

private:
u8 m_prg_bank;
u16 m_cop_bank;
Expand Down
Loading
Loading