mirror of
https://github.com/holub/mame
synced 2025-06-04 11:56:28 +03:00
Merge pull request #5305 from cam900/dooyong_args
dooyong.cpp : Updates
This commit is contained in:
commit
59f3d063f0
File diff suppressed because it is too large
Load Diff
@ -26,7 +26,7 @@ dooyong_tilemap_device_base::dooyong_tilemap_device_base(
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock)
|
||||
u32 clock)
|
||||
: device_t(mconfig, type, tag, owner, clock)
|
||||
, m_gfxdecode(*this, finder_base::DUMMY_TAG)
|
||||
, m_gfxnum(0)
|
||||
@ -35,12 +35,12 @@ dooyong_tilemap_device_base::dooyong_tilemap_device_base(
|
||||
{
|
||||
}
|
||||
|
||||
void dooyong_tilemap_device_base::draw(screen_device &screen, bitmap_ind16 &dest, rectangle const &cliprect, uint32_t flags, uint8_t priority)
|
||||
void dooyong_tilemap_device_base::draw(screen_device &screen, bitmap_ind16 &dest, rectangle const &cliprect, u32 flags, u8 priority, u8 priority_mask)
|
||||
{
|
||||
m_tilemap->draw(screen, dest, cliprect, flags, priority);
|
||||
m_tilemap->draw(screen, dest, cliprect, flags, priority, priority_mask);
|
||||
}
|
||||
|
||||
void dooyong_tilemap_device_base::set_palette_bank(uint16_t bank)
|
||||
void dooyong_tilemap_device_base::set_palette_bank(u16 bank)
|
||||
{
|
||||
if (bank != m_palette_bank)
|
||||
{
|
||||
@ -49,8 +49,7 @@ void dooyong_tilemap_device_base::set_palette_bank(uint16_t bank)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dooyong_rom_tilemap_device::dooyong_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
|
||||
dooyong_rom_tilemap_device::dooyong_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
|
||||
: dooyong_rom_tilemap_device(mconfig, DOOYONG_ROM_TILEMAP, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
@ -60,23 +59,21 @@ dooyong_rom_tilemap_device::dooyong_rom_tilemap_device(
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock)
|
||||
u32 clock)
|
||||
: dooyong_tilemap_device_base(mconfig, type, tag, owner, clock)
|
||||
, m_rows(8)
|
||||
, m_tilerom(*this, finder_base::DUMMY_TAG)
|
||||
, m_tilerom_offset(0)
|
||||
, m_tilerom_length(~0U)
|
||||
, m_transparent_pen(~0U)
|
||||
, m_primella_code_mask(0x03ff)
|
||||
, m_primella_color_mask(0x3c00)
|
||||
, m_primella_color_shift(10)
|
||||
, m_registers{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
{
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(dooyong_rom_tilemap_device::ctrl_w)
|
||||
void dooyong_rom_tilemap_device::ctrl_w(offs_t offset, u8 data)
|
||||
{
|
||||
offset &= 0x07U;
|
||||
uint8_t const old = m_registers[offset];
|
||||
const u8 old = m_registers[offset];
|
||||
if (old != data)
|
||||
{
|
||||
m_registers[offset] = data;
|
||||
@ -111,6 +108,8 @@ void dooyong_rom_tilemap_device::device_start()
|
||||
if (!m_gfxdecode->started())
|
||||
throw device_missing_dependencies();
|
||||
|
||||
m_tmap_cb.bind_relative_to(*owner());
|
||||
|
||||
m_tilemap = &machine().tilemap().create(
|
||||
*m_gfxdecode,
|
||||
tilemap_get_info_delegate(FUNC(dooyong_rom_tilemap_device::tile_info), this),
|
||||
@ -125,6 +124,9 @@ void dooyong_rom_tilemap_device::device_start()
|
||||
if (0 > m_tilerom_offset)
|
||||
m_tilerom_offset = m_tilerom.length() + m_tilerom_offset;
|
||||
|
||||
if (m_tilerom_length < 0)
|
||||
m_tilerom_length = m_tilerom.length();
|
||||
|
||||
std::fill(std::begin(m_registers), std::end(m_registers), 0U);
|
||||
m_palette_bank = 0U;
|
||||
|
||||
@ -134,8 +136,9 @@ void dooyong_rom_tilemap_device::device_start()
|
||||
|
||||
TILE_GET_INFO_MEMBER(dooyong_rom_tilemap_device::tile_info)
|
||||
{
|
||||
unsigned const attr = m_tilerom[m_tilerom_offset + adjust_tile_index(tile_index)];
|
||||
unsigned code, color, flags;
|
||||
const int tile_index_tile = adjust_tile_index(tile_index) & (m_tilerom_length - 1);
|
||||
const u16 attr = m_tilerom[m_tilerom_offset + tile_index_tile];
|
||||
u32 code = 0, color = 0, flags;
|
||||
if (BIT(m_registers[6], 5))
|
||||
{ // lastday/gulfstrm/pollux/flytiger
|
||||
// Tiles take one word in ROM:
|
||||
@ -146,13 +149,14 @@ TILE_GET_INFO_MEMBER(dooyong_rom_tilemap_device::tile_info)
|
||||
// X = x flip
|
||||
// Y = y flip
|
||||
code = (BIT(attr, 15) << 9) | (attr & 0x01ff);
|
||||
color = m_palette_bank | ((attr >> 11) & 0x0fU);
|
||||
color = (attr >> 11) & 0x0fU;
|
||||
flags = TILE_FLIPYX((attr >> 9) & 0x03U);
|
||||
}
|
||||
else
|
||||
{ // primella/popbingo
|
||||
{ // bluehawk/primella/popbingo
|
||||
// Tiles take one word in ROM:
|
||||
// MSB LSB
|
||||
// bluehawk YXCC CCcc cccc cccc (Y flip, X flip, bits 3-0 of color code, bits 9-0 of gfx code)
|
||||
// primella YXCC CCcc cccc cccc (Y flip, X flip, bits 3-0 of color code, bits 9-0 of gfx code)
|
||||
// popbingo YX?? ?ccc cccc cccc (Y flip, X flip, bits 3-0 of color code, bits 10-0 of gfx code)
|
||||
// rshark YX?c cccc cccc cccc (Y flip, X flip, bits 3-0 of color code, bits 12-0 of gfx code)
|
||||
@ -161,19 +165,27 @@ TILE_GET_INFO_MEMBER(dooyong_rom_tilemap_device::tile_info)
|
||||
// X = x flip
|
||||
// Y = y flip
|
||||
// ? = unused?
|
||||
color = m_palette_bank | ((attr & m_primella_color_mask) >> m_primella_color_shift);
|
||||
if (!m_tmap_cb.isnull())
|
||||
m_tmap_cb(attr & 0x3fff, code, color);
|
||||
else // just mimic old driver behavior (default configuration)
|
||||
{
|
||||
code = attr & 0x3ff;
|
||||
color = (attr & 0x3c00) >> 10;
|
||||
}
|
||||
|
||||
flags = TILE_FLIPYX((attr >> 14) & 0x03U);
|
||||
code = attr & m_primella_code_mask;
|
||||
}
|
||||
color |= m_palette_bank;
|
||||
|
||||
tileinfo.set(m_gfxnum, code, color, flags);
|
||||
}
|
||||
|
||||
|
||||
rshark_rom_tilemap_device::rshark_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
|
||||
rshark_rom_tilemap_device::rshark_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
|
||||
: dooyong_rom_tilemap_device(mconfig, RSHARK_ROM_TILEMAP, tag, owner, clock)
|
||||
, m_colorrom(*this, finder_base::DUMMY_TAG)
|
||||
, m_colorrom_offset(0)
|
||||
, m_colorrom_length(0)
|
||||
{
|
||||
m_rows = 32;
|
||||
}
|
||||
@ -184,27 +196,31 @@ void rshark_rom_tilemap_device::device_start()
|
||||
|
||||
if (0 > m_colorrom_offset)
|
||||
m_colorrom_offset = m_colorrom.length() + m_colorrom_offset;
|
||||
|
||||
if (m_colorrom_length < 0)
|
||||
m_colorrom_length = m_colorrom.length();
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(rshark_rom_tilemap_device::tile_info)
|
||||
{
|
||||
dooyong_rom_tilemap_device::tile_info(tilemap, tileinfo, tile_index);
|
||||
|
||||
uint8_t const color = m_colorrom[m_colorrom_offset + adjust_tile_index(tile_index)] & 0x0fU;
|
||||
const int tile_index_color = adjust_tile_index(tile_index) & (m_colorrom_length - 1);
|
||||
const u16 color = m_palette_bank | (m_colorrom[m_colorrom_offset + tile_index_color] & 0x0fU);
|
||||
tileinfo.palette_base = gfx().colorbase() + (gfx().granularity() * (color % gfx().colors()));
|
||||
}
|
||||
|
||||
|
||||
dooyong_ram_tilemap_device::dooyong_ram_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock)
|
||||
dooyong_ram_tilemap_device::dooyong_ram_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
|
||||
: dooyong_tilemap_device_base(mconfig, DOOYONG_RAM_TILEMAP, tag, owner, clock)
|
||||
, m_tileram()
|
||||
{
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(dooyong_ram_tilemap_device::tileram_w)
|
||||
void dooyong_ram_tilemap_device::tileram_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
{
|
||||
offset &= (64U * 32U) - 1U;
|
||||
uint16_t value(m_tileram[offset]);
|
||||
u16 value(m_tileram[offset]);
|
||||
COMBINE_DATA(&value);
|
||||
if (value != m_tileram[offset])
|
||||
{
|
||||
@ -228,7 +244,7 @@ void dooyong_ram_tilemap_device::device_start()
|
||||
32);
|
||||
m_tilemap->set_transparent_pen(15);
|
||||
|
||||
m_tileram.reset(new uint16_t[64 * 32]);
|
||||
m_tileram.reset(new u16[64 * 32]);
|
||||
std::fill(m_tileram.get(), m_tileram.get() + (64 * 32), 0U);
|
||||
m_palette_bank = 0U;
|
||||
|
||||
@ -243,6 +259,6 @@ TILE_GET_INFO_MEMBER(dooyong_ram_tilemap_device::tile_info)
|
||||
// CCCC cccc cccc cccc (bits 3-0 of color code, bits 11-0 of gfx code)
|
||||
// c = gfx code
|
||||
// C = color code
|
||||
unsigned const attr(m_tileram[tile_index]);
|
||||
const u16 attr(m_tileram[tile_index]);
|
||||
tileinfo.set(m_gfxnum, attr & 0x0fffU, m_palette_bank | ((attr >> 12) & 0x0fU), 0);
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ public:
|
||||
template <typename T> void set_gfxdecode_tag(T &&cpu_tag) { m_gfxdecode.set_tag(std::forward<T>(cpu_tag)); }
|
||||
void set_gfxnum(int gfxnum) { m_gfxnum = gfxnum; }
|
||||
|
||||
void draw(screen_device &screen, bitmap_ind16 &dest, rectangle const &cliprect, uint32_t flags, uint8_t priority);
|
||||
void draw(screen_device &screen, bitmap_ind16 &dest, rectangle const &cliprect, u32 flags, u8 priority, u8 priority_mask = 0xff);
|
||||
|
||||
void set_palette_bank(uint16_t bank);
|
||||
void set_palette_bank(u16 bank);
|
||||
|
||||
protected:
|
||||
dooyong_tilemap_device_base(
|
||||
@ -28,7 +28,7 @@ protected:
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock);
|
||||
u32 clock);
|
||||
|
||||
gfx_element const &gfx() const { return *m_gfxdecode->gfx(m_gfxnum); }
|
||||
|
||||
@ -36,35 +36,34 @@ protected:
|
||||
int m_gfxnum;
|
||||
|
||||
tilemap_t *m_tilemap;
|
||||
uint16_t m_palette_bank;
|
||||
u16 m_palette_bank;
|
||||
};
|
||||
|
||||
class dooyong_rom_tilemap_device : public dooyong_tilemap_device_base
|
||||
{
|
||||
public:
|
||||
template <typename T, typename U>
|
||||
dooyong_rom_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&gfxdecode_tag, int gfxnum, U &&tilerom_tag, int tilerom_offset)
|
||||
dooyong_rom_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&gfxdecode_tag, int gfxnum, U &&tilerom_tag, int tilerom_offset, int tilerom_length)
|
||||
: dooyong_rom_tilemap_device(mconfig, tag, owner, 0)
|
||||
{
|
||||
set_gfxdecode_tag(std::forward<T>(gfxdecode_tag));
|
||||
set_gfxnum(gfxnum);
|
||||
set_tilerom_tag(std::forward<U>(tilerom_tag));
|
||||
set_tilerom_offset(tilerom_offset);
|
||||
set_tilerom_length(tilerom_length);
|
||||
}
|
||||
|
||||
dooyong_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);
|
||||
dooyong_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
template <typename U> void set_tilerom_tag(U &&tilerom_tag) { m_tilerom.set_tag(std::forward<U>(tilerom_tag)); }
|
||||
void set_tilerom_offset(int offset) { m_tilerom_offset = offset; }
|
||||
void set_tilerom_length(int length) { m_tilerom_length = length; }
|
||||
void set_transparent_pen(unsigned pen) { m_transparent_pen = pen; }
|
||||
void set_primella_code_bits(unsigned bits)
|
||||
{
|
||||
m_primella_code_mask = (1U << bits) - 1U;
|
||||
m_primella_color_mask = ((1U << 14) - 1) & ~m_primella_code_mask;
|
||||
m_primella_color_shift = bits;
|
||||
}
|
||||
|
||||
DECLARE_WRITE8_MEMBER(ctrl_w);
|
||||
typedef device_delegate<void (u16 attr, u32 &code, u32 &color)> dooyong_tmap_cb_delegate;
|
||||
void set_tile_callback(dooyong_tmap_cb_delegate cb) { m_tmap_cb = cb; }
|
||||
|
||||
void ctrl_w(offs_t offset, u8 data);
|
||||
|
||||
protected:
|
||||
dooyong_rom_tilemap_device(
|
||||
@ -72,7 +71,7 @@ protected:
|
||||
device_type type,
|
||||
char const *tag,
|
||||
device_t *owner,
|
||||
uint32_t clock);
|
||||
u32 clock);
|
||||
|
||||
virtual void device_start() override;
|
||||
|
||||
@ -84,36 +83,37 @@ protected:
|
||||
int m_rows;
|
||||
|
||||
private:
|
||||
required_region_ptr<uint16_t> m_tilerom;
|
||||
required_region_ptr<u16> m_tilerom;
|
||||
int m_tilerom_offset;
|
||||
int m_tilerom_length;
|
||||
unsigned m_transparent_pen;
|
||||
unsigned m_primella_code_mask;
|
||||
unsigned m_primella_color_mask;
|
||||
unsigned m_primella_color_shift;
|
||||
|
||||
uint8_t m_registers[0x10];
|
||||
u8 m_registers[0x10];
|
||||
dooyong_tmap_cb_delegate m_tmap_cb;
|
||||
};
|
||||
|
||||
class rshark_rom_tilemap_device : public dooyong_rom_tilemap_device
|
||||
{
|
||||
public:
|
||||
template <typename T, typename U, typename V>
|
||||
rshark_rom_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&gfxdecode_tag, int gfxnum, U &&tilerom_tag, int tilerom_offset, V &&colorrom_tag, int colorrom_offset)
|
||||
rshark_rom_tilemap_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&gfxdecode_tag, int gfxnum, U &&tilerom_tag, int tilerom_offset, int tilerom_length, V &&colorrom_tag, int colorrom_offset, int colorrom_length)
|
||||
: rshark_rom_tilemap_device(mconfig, tag, owner, 0)
|
||||
{
|
||||
set_gfxdecode_tag(std::forward<T>(gfxdecode_tag));
|
||||
set_gfxnum(gfxnum);
|
||||
set_tilerom_tag(std::forward<U>(tilerom_tag));
|
||||
set_tilerom_offset(tilerom_offset);
|
||||
set_tilerom_length(tilerom_length);
|
||||
set_colorrom_tag(std::forward<V>(colorrom_tag));
|
||||
set_colorrom_offset(colorrom_offset);
|
||||
set_primella_code_bits(13);
|
||||
set_colorrom_length(colorrom_length);
|
||||
}
|
||||
|
||||
rshark_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);
|
||||
rshark_rom_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
template <typename V> void set_colorrom_tag(V &&colorrom_tag) { m_colorrom.set_tag(std::forward<V>(colorrom_tag)); }
|
||||
void set_colorrom_offset(int offset) { m_colorrom_offset = offset; }
|
||||
void set_colorrom_length(int length) { m_colorrom_length = length; }
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
@ -121,8 +121,9 @@ protected:
|
||||
virtual TILE_GET_INFO_MEMBER(tile_info) override;
|
||||
|
||||
private:
|
||||
required_region_ptr<uint8_t> m_colorrom;
|
||||
required_region_ptr<u8> m_colorrom;
|
||||
int m_colorrom_offset;
|
||||
int m_colorrom_length;
|
||||
};
|
||||
|
||||
class dooyong_ram_tilemap_device : public dooyong_tilemap_device_base
|
||||
@ -136,10 +137,10 @@ public:
|
||||
set_gfxnum(gfxnum);
|
||||
}
|
||||
|
||||
dooyong_ram_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock);
|
||||
dooyong_ram_tilemap_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);
|
||||
|
||||
DECLARE_READ16_MEMBER(tileram_r) { return m_tileram[offset & ((64U * 32U) - 1)]; }
|
||||
DECLARE_WRITE16_MEMBER(tileram_w);
|
||||
u16 tileram_r(offs_t offset) { return m_tileram[offset & ((64U * 32U) - 1)]; }
|
||||
void tileram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
|
||||
void set_scrolly(int value) { m_tilemap->set_scrolly(value); }
|
||||
|
||||
protected:
|
||||
@ -148,7 +149,7 @@ protected:
|
||||
private:
|
||||
TILE_GET_INFO_MEMBER(tile_info);
|
||||
|
||||
std::unique_ptr<uint16_t[]> m_tileram;
|
||||
std::unique_ptr<u16[]> m_tileram;
|
||||
};
|
||||
|
||||
#endif // MAME_VIDEO_DOOYONG_H
|
||||
|
Loading…
Reference in New Issue
Block a user