mirror of
https://github.com/holub/mame
synced 2025-07-03 09:06:08 +03:00
Convert rshark/superx ROM-based tilemaps to device as well, remove all the trampolines
This commit is contained in:
parent
67bedd6b2e
commit
c70fee9c71
@ -231,13 +231,13 @@ static ADDRESS_MAP_START( rshark_map, AS_PROGRAM, 16, dooyong_68k_state )
|
||||
AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2")
|
||||
AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff)
|
||||
AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff)
|
||||
AM_RANGE(0x0c4000, 0x0c400f) AM_DEVWRITE8("bg", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x0c4010, 0x0c401f) AM_DEVWRITE8("bg2", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
|
||||
AM_RANGE(0x0c0012, 0x0c0013) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
|
||||
AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */
|
||||
AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff)
|
||||
AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff)
|
||||
AM_RANGE(0x0cc000, 0x0cc00f) AM_DEVWRITE8("fg", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x0cc010, 0x0cc01f) AM_DEVWRITE8("fg2", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( superx_map, AS_PROGRAM, 16, dooyong_68k_state )
|
||||
@ -249,13 +249,13 @@ static ADDRESS_MAP_START( superx_map, AS_PROGRAM, 16, dooyong_68k_state )
|
||||
AM_RANGE(0x080002, 0x080003) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0x080004, 0x080005) AM_READ_PORT("P1_P2")
|
||||
AM_RANGE(0x080006, 0x080007) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0x084000, 0x08400f) AM_WRITE8(bgscroll_w, 0x00ff)
|
||||
AM_RANGE(0x084010, 0x08401f) AM_WRITE8(bg2scroll_w, 0x00ff)
|
||||
AM_RANGE(0x084000, 0x08400f) AM_DEVWRITE8("bg", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x084010, 0x08401f) AM_DEVWRITE8("bg2", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x088000, 0x088fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
|
||||
AM_RANGE(0x080012, 0x080013) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff)
|
||||
AM_RANGE(0x080014, 0x080015) AM_WRITE(ctrl_w) /* flip screen + unknown stuff */
|
||||
AM_RANGE(0x08c000, 0x08c00f) AM_WRITE8(fgscroll_w, 0x00ff)
|
||||
AM_RANGE(0x08c010, 0x08c01f) AM_WRITE8(fg2scroll_w, 0x00ff)
|
||||
AM_RANGE(0x08c000, 0x08c00f) AM_DEVWRITE8("fg", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x08c010, 0x08c01f) AM_DEVWRITE8("fg2", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( popbingo_map, AS_PROGRAM, 16, dooyong_68k_state )
|
||||
@ -273,8 +273,8 @@ static ADDRESS_MAP_START( popbingo_map, AS_PROGRAM, 16, dooyong_68k_state )
|
||||
AM_RANGE(0x0c4000, 0x0c400f) AM_DEVWRITE8("bg", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x0c4010, 0x0c401f) AM_DEVWRITE8("bg2", dooyong_rom_tilemap_device, ctrl_w, 0x00ff)
|
||||
AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
|
||||
//AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff) // not used atm
|
||||
//AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff) // not used atm
|
||||
//AM_RANGE(0x08c000, 0x08c00f) AM_DEVWRITE8("fg", dooyong_rom_tilemap_device, ctrl_w, 0x00ff) apparently not present
|
||||
//AM_RANGE(0x08c010, 0x08c01f) AM_DEVWRITE8("fg2", dooyong_rom_tilemap_device, ctrl_w, 0x00ff) apparently not present
|
||||
AM_RANGE(0x0dc000, 0x0dc01f) AM_RAM // registers of some kind?
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -1090,6 +1090,13 @@ static MACHINE_CONFIG_START( rshark, dooyong_68k_state )
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark)
|
||||
MCFG_PALETTE_ADD("palette", 2048)
|
||||
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("bg", "gfxdecode", 4, "gfx5", 0x00000, "gfx6", 0x60000)
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("bg2", "gfxdecode", 3, "gfx4", 0x00000, "gfx6", 0x40000)
|
||||
MCFG_DOOYONG_ROM_TILEMAP_TRANSPARENT_PEN(15);
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("fg", "gfxdecode", 2, "gfx3", 0x00000, "gfx6", 0x20000)
|
||||
MCFG_DOOYONG_ROM_TILEMAP_TRANSPARENT_PEN(15);
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("fg2", "gfxdecode", 1, "gfx2", 0x00000, "gfx6", 0x00000)
|
||||
MCFG_DOOYONG_ROM_TILEMAP_TRANSPARENT_PEN(15);
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark)
|
||||
|
||||
@ -1122,6 +1129,13 @@ static MACHINE_CONFIG_START( superx, dooyong_68k_state ) // dif mem map
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", rshark)
|
||||
MCFG_PALETTE_ADD("palette", 2048)
|
||||
MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("bg", "gfxdecode", 4, "gfx5", 0x00000, "gfx6", 0x60000)
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("bg2", "gfxdecode", 3, "gfx4", 0x00000, "gfx6", 0x40000)
|
||||
MCFG_DOOYONG_ROM_TILEMAP_TRANSPARENT_PEN(15);
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("fg", "gfxdecode", 2, "gfx3", 0x00000, "gfx6", 0x20000)
|
||||
MCFG_DOOYONG_ROM_TILEMAP_TRANSPARENT_PEN(15);
|
||||
MCFG_RSHARK_ROM_TILEMAP_ADD("fg2", "gfxdecode", 1, "gfx2", 0x00000, "gfx6", 0x00000)
|
||||
MCFG_DOOYONG_ROM_TILEMAP_TRANSPARENT_PEN(15);
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(dooyong_68k_state, rshark)
|
||||
|
||||
|
@ -13,7 +13,20 @@
|
||||
#define MCFG_DOOYONG_ROM_TILEMAP_PRIMELLA_CODE_BITS(bits) \
|
||||
dooyong_rom_tilemap_device::static_set_primella_code_bits(*device, (bits));
|
||||
|
||||
#define MCFG_RSHARK_ROM_TILEMAP_ADD(tag, gfx, num, rom, offset, rom2, offset2) \
|
||||
MCFG_DEVICE_ADD(tag, RSHARK_ROM_TILEMAP, 0) \
|
||||
dooyong_rom_tilemap_device::static_set_gfxdecode_tag(*device, "^" gfx); \
|
||||
dooyong_rom_tilemap_device::static_set_tilerom_tag(*device, "^" rom); \
|
||||
dooyong_rom_tilemap_device::static_set_gfxnum(*device, (num)); \
|
||||
dooyong_rom_tilemap_device::static_set_tilerom_offset(*device, (offset)); \
|
||||
dooyong_rom_tilemap_device::static_set_primella_code_bits(*device, 13); \
|
||||
rshark_rom_tilemap_device::static_set_colorrom_tag(*device, "^" rom2); \
|
||||
rshark_rom_tilemap_device::static_set_colorrom_offset(*device, (offset2));
|
||||
|
||||
|
||||
extern device_type const DOOYONG_ROM_TILEMAP;
|
||||
extern device_type const RSHARK_ROM_TILEMAP;
|
||||
|
||||
|
||||
class dooyong_rom_tilemap_device : public device_t
|
||||
{
|
||||
@ -33,11 +46,29 @@ public:
|
||||
void set_palette_bank(UINT16 bank);
|
||||
|
||||
protected:
|
||||
dooyong_rom_tilemap_device(
|
||||
machine_config const &mconfig,
|
||||
device_type type,
|
||||
char const *name,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
UINT32 clock,
|
||||
char const *shortname,
|
||||
char const *source);
|
||||
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
TILE_GET_INFO_MEMBER(tile_info);
|
||||
virtual TILE_GET_INFO_MEMBER(tile_info);
|
||||
|
||||
gfx_element const &gfx() const
|
||||
{ return *m_gfxdecode->gfx(m_gfxnum); }
|
||||
|
||||
tilemap_memory_index adjust_tile_index(tilemap_memory_index tile_index) const
|
||||
{ return tile_index + ((unsigned(m_registers[1]) * 256U / gfx().width()) * m_rows); }
|
||||
|
||||
int m_rows;
|
||||
|
||||
private:
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_region_ptr<UINT8> m_tilerom;
|
||||
int m_gfxnum;
|
||||
@ -54,6 +85,25 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class rshark_rom_tilemap_device : public dooyong_rom_tilemap_device
|
||||
{
|
||||
public:
|
||||
rshark_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void static_set_colorrom_tag(device_t &device, char const *tag);
|
||||
static void static_set_colorrom_offset(device_t &device, int offset);
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
|
||||
virtual TILE_GET_INFO_MEMBER(tile_info) override;
|
||||
|
||||
private:
|
||||
required_region_ptr<UINT8> m_colorrom;
|
||||
int m_colorrom_offset;
|
||||
};
|
||||
|
||||
|
||||
class dooyong_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -65,6 +115,8 @@ public:
|
||||
, m_palette(*this, "palette")
|
||||
, m_bg(*this, "bg")
|
||||
, m_bg2(*this, "bg2")
|
||||
, m_fg(*this, "fg")
|
||||
, m_fg2(*this, "fg2")
|
||||
{ }
|
||||
|
||||
tilemap_t *m_tx_tilemap = nullptr;
|
||||
@ -75,6 +127,8 @@ public:
|
||||
required_device<palette_device> m_palette;
|
||||
optional_device<dooyong_rom_tilemap_device> m_bg;
|
||||
optional_device<dooyong_rom_tilemap_device> m_bg2;
|
||||
optional_device<dooyong_rom_tilemap_device> m_fg;
|
||||
optional_device<dooyong_rom_tilemap_device> m_fg2;
|
||||
};
|
||||
|
||||
class dooyong_z80_state : public dooyong_state
|
||||
@ -83,8 +137,6 @@ public:
|
||||
dooyong_z80_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: dooyong_state(mconfig, type, tag)
|
||||
, m_txvideoram(*this, "txvideoram")
|
||||
, m_fg(*this, "fg")
|
||||
, m_fg2(*this, "fg2")
|
||||
, m_spriteram(*this, "spriteram")
|
||||
{ }
|
||||
|
||||
@ -121,8 +173,6 @@ public:
|
||||
UINT8 m_palette_bank = 0;
|
||||
int m_tx_tilemap_mode = 0;
|
||||
|
||||
optional_device<dooyong_rom_tilemap_device> m_fg;
|
||||
optional_device<dooyong_rom_tilemap_device> m_fg2;
|
||||
optional_device<buffered_spriteram8_device> m_spriteram;
|
||||
};
|
||||
|
||||
@ -161,53 +211,14 @@ public:
|
||||
, m_spriteram(*this, "spriteram")
|
||||
{ }
|
||||
|
||||
void clear_video_regs()
|
||||
{
|
||||
std::fill(std::begin(m_bgscroll8), std::end(m_bgscroll8), 0);
|
||||
std::fill(std::begin(m_bg2scroll8), std::end(m_bg2scroll8), 0);
|
||||
std::fill(std::begin(m_fgscroll8), std::end(m_fgscroll8), 0);
|
||||
std::fill(std::begin(m_fg2scroll8), std::end(m_fg2scroll8), 0);
|
||||
}
|
||||
|
||||
DECLARE_WRITE8_MEMBER(bgscroll_w);
|
||||
DECLARE_WRITE8_MEMBER(bg2scroll_w);
|
||||
DECLARE_WRITE8_MEMBER(fgscroll_w);
|
||||
DECLARE_WRITE8_MEMBER(fg2scroll_w);
|
||||
inline void scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map);
|
||||
|
||||
DECLARE_WRITE16_MEMBER(ctrl_w);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
|
||||
TILE_GET_INFO_MEMBER(rshark_get_bg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(rshark_get_bg2_tile_info);
|
||||
TILE_GET_INFO_MEMBER(rshark_get_fg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(rshark_get_fg2_tile_info);
|
||||
inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics);
|
||||
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_VIDEO_START(rshark);
|
||||
DECLARE_VIDEO_START(popbingo);
|
||||
|
||||
tilemap_t *m_bg_tilemap = nullptr;
|
||||
tilemap_t *m_bg2_tilemap = nullptr;
|
||||
tilemap_t *m_fg_tilemap = nullptr;
|
||||
tilemap_t *m_fg2_tilemap = nullptr;
|
||||
UINT8 m_bgscroll8[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
UINT8 m_bg2scroll8[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
UINT8 m_fgscroll8[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
UINT8 m_fg2scroll8[0x10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
UINT8 *m_bg_tilerom = nullptr;
|
||||
UINT8 *m_bg_tilerom2 = nullptr;
|
||||
UINT8 *m_bg2_tilerom = nullptr;
|
||||
UINT8 *m_bg2_tilerom2 = nullptr;
|
||||
UINT8 *m_fg_tilerom = nullptr;
|
||||
UINT8 *m_fg_tilerom2 = nullptr;
|
||||
UINT8 *m_fg2_tilerom = nullptr;
|
||||
UINT8 *m_fg2_tilerom2 = nullptr;
|
||||
int m_bg_gfx = 0;
|
||||
int m_bg2_gfx = 0;
|
||||
int m_fg_gfx = 0;
|
||||
int m_fg2_gfx = 0;
|
||||
UINT16 m_bg2_priority = 0;
|
||||
|
||||
bitmap_ind16 m_bg_bitmap;
|
||||
|
@ -15,10 +15,25 @@
|
||||
at once uses hundreds of megabytes of RAM). */
|
||||
|
||||
device_type const DOOYONG_ROM_TILEMAP = &device_creator<dooyong_rom_tilemap_device>;
|
||||
device_type const RSHARK_ROM_TILEMAP = &device_creator<rshark_rom_tilemap_device>;
|
||||
|
||||
|
||||
dooyong_rom_tilemap_device::dooyong_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, DOOYONG_ROM_TILEMAP, "Dooyong ROM Tilemap", tag, owner, clock, "dooyong_rom_tilemap", __FILE__)
|
||||
: dooyong_rom_tilemap_device(mconfig, DOOYONG_ROM_TILEMAP, "Dooyong ROM Tilemap", tag, owner, clock, "dooyong_rom_tilemap", __FILE__)
|
||||
{
|
||||
}
|
||||
|
||||
dooyong_rom_tilemap_device::dooyong_rom_tilemap_device(
|
||||
machine_config const &mconfig,
|
||||
device_type type,
|
||||
char const *name,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
UINT32 clock,
|
||||
char const *shortname,
|
||||
char const *source)
|
||||
: device_t(mconfig, type, name, tag, owner, clock, shortname, source)
|
||||
, m_rows(8)
|
||||
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
|
||||
, m_tilerom(*this, finder_base::DUMMY_TAG)
|
||||
, m_gfxnum(0)
|
||||
@ -114,16 +129,21 @@ void dooyong_rom_tilemap_device::set_palette_bank(UINT16 bank)
|
||||
|
||||
void dooyong_rom_tilemap_device::device_start()
|
||||
{
|
||||
if (!m_gfxdecode->started())
|
||||
throw device_missing_dependencies();
|
||||
|
||||
m_tilemap = &machine().tilemap().create(
|
||||
*m_gfxdecode,
|
||||
tilemap_get_info_delegate(FUNC(dooyong_rom_tilemap_device::tile_info), this),
|
||||
TILEMAP_SCAN_COLS,
|
||||
32, 32,
|
||||
32, 8);
|
||||
gfx().width(),
|
||||
gfx().height(),
|
||||
1024 / gfx().width(),
|
||||
m_rows);
|
||||
if (~m_transparent_pen)
|
||||
m_tilemap->set_transparent_pen(m_transparent_pen);
|
||||
|
||||
if (m_tilerom_offset < 0)
|
||||
if (0 > m_tilerom_offset)
|
||||
m_tilerom_offset = m_tilerom.length() + m_tilerom_offset;
|
||||
|
||||
std::fill(std::begin(m_registers), std::end(m_registers), 0);
|
||||
@ -135,7 +155,7 @@ void dooyong_rom_tilemap_device::device_start()
|
||||
|
||||
TILE_GET_INFO_MEMBER(dooyong_rom_tilemap_device::tile_info)
|
||||
{
|
||||
tilemap_memory_index const offs = (tile_index + (unsigned(m_registers[1]) << 6)) << 1;
|
||||
tilemap_memory_index const offs = adjust_tile_index(tile_index) << 1;
|
||||
unsigned const attr = m_tilerom[m_tilerom_offset + offs];
|
||||
unsigned code, color, flags;
|
||||
if (BIT(m_registers[6], 5))
|
||||
@ -172,68 +192,38 @@ TILE_GET_INFO_MEMBER(dooyong_rom_tilemap_device::tile_info)
|
||||
}
|
||||
|
||||
|
||||
inline void dooyong_68k_state::scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map)
|
||||
rshark_rom_tilemap_device::rshark_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, UINT32 clock)
|
||||
: dooyong_rom_tilemap_device(mconfig, RSHARK_ROM_TILEMAP, "Dooyong ROM Tilemap", tag, owner, clock, "dooyong_rom_tilemap", __FILE__)
|
||||
, m_colorrom(*this, finder_base::DUMMY_TAG)
|
||||
, m_colorrom_offset(0)
|
||||
{
|
||||
UINT8 const old = scroll[offset];
|
||||
if (old != data)
|
||||
{
|
||||
scroll[offset] = data;
|
||||
if (map != nullptr) switch (offset)
|
||||
{
|
||||
case 0: /* Low byte of x scroll - scroll tilemap */
|
||||
map->set_scrollx(0, data);
|
||||
break;
|
||||
case 1: /* High byte of x scroll - mark tilemap dirty so new tile gfx will be loaded */
|
||||
map->mark_all_dirty();
|
||||
break;
|
||||
case 3: /* Low byte of y scroll */
|
||||
case 4: /* High byte of y scroll */
|
||||
map->set_scrolly(0, (unsigned)scroll[3] | ((unsigned)scroll[4] << 8));
|
||||
break;
|
||||
case 6: /* Tilemap enable and mode control */
|
||||
map->enable(!(data & 0x10));
|
||||
if ((data & 0x20) != (old & 0x20)) // This sets the tilemap data format
|
||||
map->mark_all_dirty();
|
||||
break;
|
||||
default: /* Other addresses are used but function is unknown */
|
||||
/* 0x05 and 0x07 are initialised on startup */
|
||||
/* 0x02 is initialised on startup by some games and written to continuously by others */
|
||||
/*{
|
||||
const char *name;
|
||||
if (scroll == m_bgscroll8) name = "bg";
|
||||
else if (scroll == m_bg2scroll8) name = "bg2";
|
||||
else if (scroll == m_fgscroll8) name = "fg";
|
||||
else if (scroll == m_fg2scroll8) name = "fg2";
|
||||
else name = "unknown";
|
||||
printf("Unknown %s tilemap control: 0x%02x = 0x%02x\n", name, (unsigned)offset, (unsigned)data);
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_rows = 32;
|
||||
}
|
||||
|
||||
|
||||
/* These handle writes to the tilemap scroll registers.
|
||||
There is one per tilemap, wrapping the above function that does the work. */
|
||||
|
||||
WRITE8_MEMBER(dooyong_68k_state::bgscroll_w)
|
||||
void rshark_rom_tilemap_device::static_set_colorrom_tag(device_t &device, char const *tag)
|
||||
{
|
||||
scroll8_w(offset, data, m_bgscroll8, m_bg_tilemap);
|
||||
downcast<rshark_rom_tilemap_device &>(device).m_colorrom.set_tag(tag);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(dooyong_68k_state::bg2scroll_w)
|
||||
void rshark_rom_tilemap_device::static_set_colorrom_offset(device_t &device, int offset)
|
||||
{
|
||||
scroll8_w(offset, data, m_bg2scroll8, m_bg2_tilemap);
|
||||
downcast<rshark_rom_tilemap_device &>(device).m_colorrom_offset = offset;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(dooyong_68k_state::fgscroll_w)
|
||||
void rshark_rom_tilemap_device::device_start()
|
||||
{
|
||||
scroll8_w(offset, data, m_fgscroll8, m_fg_tilemap);
|
||||
dooyong_rom_tilemap_device::device_start();
|
||||
|
||||
if (0 > m_colorrom_offset)
|
||||
m_colorrom_offset = m_colorrom.length() + m_colorrom_offset;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(dooyong_68k_state::fg2scroll_w)
|
||||
TILE_GET_INFO_MEMBER(rshark_rom_tilemap_device::tile_info)
|
||||
{
|
||||
scroll8_w(offset, data, m_fg2scroll8, m_fg2_tilemap);
|
||||
dooyong_rom_tilemap_device::tile_info(tilemap, tileinfo, tile_index);
|
||||
|
||||
UINT8 const color = m_colorrom[m_colorrom_offset + adjust_tile_index(tile_index)] & 0x0fU;
|
||||
tileinfo.palette_base = gfx().colorbase() + (gfx().granularity() * (color % gfx().colors()));
|
||||
}
|
||||
|
||||
|
||||
@ -704,47 +694,6 @@ WRITE16_MEMBER(dooyong_68k_state::ctrl_w)
|
||||
}
|
||||
|
||||
|
||||
inline void dooyong_68k_state::rshark_get_tile_info(tile_data &tileinfo, int tile_index,
|
||||
UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics)
|
||||
{
|
||||
/* Tiles take two bytes in tile ROM 1:
|
||||
MSB LSB
|
||||
[offs + 0x00] YX?c cccc (Y flip, X flip, bits 12-8 of gfx code)
|
||||
[offs + 0x01] cccc cccc (bits 7-0 of gfx code)
|
||||
? = unused/unknown
|
||||
c = gfx code
|
||||
X = x flip
|
||||
Y = y flip */
|
||||
int const offs = tile_index + ((int)scroll[1] << 9);
|
||||
int const attr = tilerom1[offs * 2];
|
||||
int const code = tilerom1[(offs * 2) + 1] | ((attr & 0x1f) << 8);
|
||||
int const color = tilerom2[offs] & 0x0f;
|
||||
int const flags = TILE_FLIPYX((attr & 0xC0) >> 6);
|
||||
|
||||
tileinfo.set(graphics, code, color, flags);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg_tile_info)
|
||||
{
|
||||
rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg2_tile_info)
|
||||
{
|
||||
rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg_tile_info)
|
||||
{
|
||||
rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg2_tile_info)
|
||||
{
|
||||
rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx);
|
||||
}
|
||||
|
||||
|
||||
void dooyong_68k_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
/* Sprites take 8 16-bit words each in memory:
|
||||
@ -814,10 +763,10 @@ UINT32 dooyong_68k_state::screen_update_rshark(screen_device &screen, bitmap_ind
|
||||
bitmap.fill(m_palette->black_pen(), cliprect);
|
||||
screen.priority().fill(0, cliprect);
|
||||
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
|
||||
m_bg2_tilemap->draw(screen, bitmap, cliprect, 0, (m_bg2_priority ? 2 : 1));
|
||||
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
|
||||
m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 2);
|
||||
m_bg->draw(screen, bitmap, cliprect, 0, 1);
|
||||
m_bg2->draw(screen, bitmap, cliprect, 0, (m_bg2_priority ? 2 : 1));
|
||||
m_fg->draw(screen, bitmap, cliprect, 0, 2);
|
||||
m_fg2->draw(screen, bitmap, cliprect, 0, 2);
|
||||
|
||||
draw_sprites(screen, bitmap, cliprect);
|
||||
|
||||
@ -853,46 +802,7 @@ UINT32 dooyong_68k_state::screen_update_popbingo(screen_device &screen, bitmap_i
|
||||
|
||||
VIDEO_START_MEMBER(dooyong_68k_state, rshark)
|
||||
{
|
||||
/* Configure tilemap callbacks */
|
||||
m_bg_tilerom = memregion("gfx5")->base();
|
||||
m_bg2_tilerom = memregion("gfx4")->base();
|
||||
m_fg_tilerom = memregion("gfx3")->base();
|
||||
m_fg2_tilerom = memregion("gfx2")->base();
|
||||
m_bg_tilerom2 = memregion("gfx6")->base() + 0x60000;
|
||||
m_bg2_tilerom2 = memregion("gfx6")->base() + 0x40000;
|
||||
m_fg_tilerom2 = memregion("gfx6")->base() + 0x20000;
|
||||
m_fg2_tilerom2 = memregion("gfx6")->base() + 0x00000;
|
||||
m_bg_gfx = 4;
|
||||
m_bg2_gfx = 3;
|
||||
m_fg_gfx = 2;
|
||||
m_fg2_gfx = 1;
|
||||
|
||||
/* Create tilemaps */
|
||||
m_bg_tilemap = &machine().tilemap().create(
|
||||
*m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg_tile_info),this), TILEMAP_SCAN_COLS,
|
||||
16, 16, 64, 32);
|
||||
m_bg2_tilemap = &machine().tilemap().create(
|
||||
*m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg2_tile_info),this), TILEMAP_SCAN_COLS,
|
||||
16, 16, 64, 32);
|
||||
m_fg_tilemap = &machine().tilemap().create(
|
||||
*m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg_tile_info),this), TILEMAP_SCAN_COLS,
|
||||
16, 16, 64, 32);
|
||||
m_fg2_tilemap = &machine().tilemap().create(
|
||||
*m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg2_tile_info),this), TILEMAP_SCAN_COLS,
|
||||
16, 16, 64, 32);
|
||||
|
||||
/* Configure tilemap transparency */
|
||||
m_bg2_tilemap->set_transparent_pen(15);
|
||||
m_fg_tilemap->set_transparent_pen(15);
|
||||
m_fg2_tilemap->set_transparent_pen(15);
|
||||
|
||||
clear_video_regs();
|
||||
|
||||
/* Register for save/restore */
|
||||
save_item(NAME(m_bgscroll8));
|
||||
save_item(NAME(m_bg2scroll8));
|
||||
save_item(NAME(m_fgscroll8));
|
||||
save_item(NAME(m_fg2scroll8));
|
||||
save_item(NAME(m_bg2_priority));
|
||||
}
|
||||
|
||||
@ -901,10 +811,6 @@ VIDEO_START_MEMBER(dooyong_68k_state, popbingo)
|
||||
m_screen->register_screen_bitmap(m_bg_bitmap);
|
||||
m_screen->register_screen_bitmap(m_bg2_bitmap);
|
||||
|
||||
clear_video_regs();
|
||||
|
||||
/* Register for save/restore */
|
||||
save_item(NAME(m_fgscroll8)); // Not used atm
|
||||
save_item(NAME(m_fg2scroll8)); // Not used atm
|
||||
save_item(NAME(m_bg2_priority)); // Not used atm
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user