mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
1945kiii : Minor cleanups, Add notes (#3614)
This commit is contained in:
parent
998eccc360
commit
bbc4e38d96
@ -59,10 +59,8 @@ class k3_state : public driver_device
|
||||
public:
|
||||
k3_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_oki2(*this, "oki2"),
|
||||
m_oki1(*this, "oki1") ,
|
||||
m_spriteram_1(*this, "spritera1"),
|
||||
m_spriteram_2(*this, "spritera2"),
|
||||
m_oki(*this, "oki%u", 1U) ,
|
||||
m_spriteram(*this, "spritera%u", 1U),
|
||||
m_bgram(*this, "bgram"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
@ -73,18 +71,18 @@ public:
|
||||
void k3(machine_config &config);
|
||||
|
||||
protected:
|
||||
DECLARE_WRITE16_MEMBER(k3_bgram_w);
|
||||
DECLARE_WRITE16_MEMBER(k3_scrollx_w);
|
||||
DECLARE_WRITE16_MEMBER(k3_scrolly_w);
|
||||
DECLARE_WRITE16_MEMBER(bgram_w);
|
||||
DECLARE_WRITE16_MEMBER(scrollx_w);
|
||||
DECLARE_WRITE16_MEMBER(scrolly_w);
|
||||
DECLARE_WRITE16_MEMBER(k3_soundbanks_w);
|
||||
DECLARE_WRITE16_MEMBER(flagrall_soundbanks_w);
|
||||
TILE_GET_INFO_MEMBER(get_k3_bg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info);
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update_k3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void k3_map(address_map &map);
|
||||
void flagrall_map(address_map &map);
|
||||
@ -92,11 +90,9 @@ protected:
|
||||
|
||||
private:
|
||||
/* devices */
|
||||
optional_device<okim6295_device> m_oki2;
|
||||
required_device<okim6295_device> m_oki1;
|
||||
optional_device_array<okim6295_device, 2> m_oki;
|
||||
/* memory pointers */
|
||||
required_shared_ptr<uint16_t> m_spriteram_1;
|
||||
required_shared_ptr<uint16_t> m_spriteram_2;
|
||||
required_shared_ptr_array<uint16_t, 2> m_spriteram;
|
||||
required_shared_ptr<uint16_t> m_bgram;
|
||||
|
||||
/* video-related */
|
||||
@ -107,13 +103,13 @@ private:
|
||||
};
|
||||
|
||||
|
||||
WRITE16_MEMBER(k3_state::k3_bgram_w)
|
||||
WRITE16_MEMBER(k3_state::bgram_w)
|
||||
{
|
||||
COMBINE_DATA(&m_bgram[offset]);
|
||||
m_bg_tilemap->mark_tile_dirty(offset);
|
||||
}
|
||||
|
||||
TILE_GET_INFO_MEMBER(k3_state::get_k3_bg_tile_info)
|
||||
TILE_GET_INFO_MEMBER(k3_state::get_tile_info)
|
||||
{
|
||||
int tileno = m_bgram[tile_index];
|
||||
SET_TILE_INFO_MEMBER(1, tileno, 0, 0);
|
||||
@ -121,15 +117,15 @@ TILE_GET_INFO_MEMBER(k3_state::get_k3_bg_tile_info)
|
||||
|
||||
void k3_state::video_start()
|
||||
{
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(k3_state::get_k3_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
|
||||
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(k3_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
|
||||
}
|
||||
|
||||
void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
gfx_element *gfx = m_gfxdecode->gfx(0);
|
||||
uint16_t *source = m_spriteram_1;
|
||||
uint16_t *source2 = m_spriteram_2;
|
||||
uint16_t *finish = source + 0x1000 / 2;
|
||||
uint16_t *source = m_spriteram[0];
|
||||
uint16_t *source2 = m_spriteram[1];
|
||||
uint16_t *finish = source + 0x1000 / 2; // TODO : Not of all spriteram are used
|
||||
|
||||
while (source < finish)
|
||||
{
|
||||
@ -148,7 +144,7 @@ void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t k3_state::screen_update_k3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
uint32_t k3_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
|
||||
draw_sprites(bitmap, cliprect);
|
||||
@ -156,20 +152,20 @@ uint32_t k3_state::screen_update_k3(screen_device &screen, bitmap_ind16 &bitmap,
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(k3_state::k3_scrollx_w)
|
||||
WRITE16_MEMBER(k3_state::scrollx_w)
|
||||
{
|
||||
m_bg_tilemap->set_scrollx(0, data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(k3_state::k3_scrolly_w)
|
||||
WRITE16_MEMBER(k3_state::scrolly_w)
|
||||
{
|
||||
m_bg_tilemap->set_scrolly(0, data);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(k3_state::k3_soundbanks_w)
|
||||
{
|
||||
m_oki2->set_rom_bank((data & 4) >> 2);
|
||||
m_oki1->set_rom_bank((data & 2) >> 1);
|
||||
m_oki[1]->set_rom_bank((data & 4) >> 2);
|
||||
m_oki[0]->set_rom_bank((data & 2) >> 1);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(k3_state::flagrall_soundbanks_w)
|
||||
@ -190,7 +186,7 @@ WRITE16_MEMBER(k3_state::flagrall_soundbanks_w)
|
||||
if (data & 0xfcc9)
|
||||
popmessage("unk control %04x", data & 0xfcc9);
|
||||
|
||||
m_oki1->set_rom_bank((data & 0x6) >> 1);
|
||||
m_oki[0]->set_rom_bank((data & 0x6) >> 1);
|
||||
|
||||
}
|
||||
|
||||
@ -206,10 +202,10 @@ void k3_state::k3_base_map(address_map &map)
|
||||
map(0x200000, 0x2003ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
|
||||
map(0x240000, 0x240fff).ram().share("spritera1");
|
||||
map(0x280000, 0x280fff).ram().share("spritera2");
|
||||
map(0x2c0000, 0x2c07ff).ram().w(FUNC(k3_state::k3_bgram_w)).share("bgram");
|
||||
map(0x2c0000, 0x2c07ff).ram().w(FUNC(k3_state::bgram_w)).share("bgram");
|
||||
map(0x2c0800, 0x2c0fff).ram(); // or does k3 have a bigger tilemap? (flagrall is definitely 32x32 tiles)
|
||||
map(0x340000, 0x340001).w(FUNC(k3_state::k3_scrollx_w));
|
||||
map(0x380000, 0x380001).w(FUNC(k3_state::k3_scrolly_w));
|
||||
map(0x340000, 0x340001).w(FUNC(k3_state::scrollx_w));
|
||||
map(0x380000, 0x380001).w(FUNC(k3_state::scrolly_w));
|
||||
map(0x400000, 0x400001).portr("INPUTS");
|
||||
map(0x440000, 0x440001).portr("SYSTEM");
|
||||
map(0x480000, 0x480001).portr("DSW");
|
||||
@ -221,8 +217,8 @@ void k3_state::k3_map(address_map &map)
|
||||
|
||||
map(0x3c0000, 0x3c0001).w(FUNC(k3_state::k3_soundbanks_w));
|
||||
|
||||
map(0x4c0001, 0x4c0001).rw(m_oki1, FUNC(okim6295_device::read), FUNC(okim6295_device::write)).cswidth(16);
|
||||
map(0x500001, 0x500001).rw(m_oki2, FUNC(okim6295_device::read), FUNC(okim6295_device::write)).cswidth(16);
|
||||
map(0x4c0001, 0x4c0001).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write)).cswidth(16);
|
||||
map(0x500001, 0x500001).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write)).cswidth(16);
|
||||
map(0x8c0000, 0x8cffff).ram(); // not used? (bug in code?)
|
||||
}
|
||||
|
||||
@ -232,7 +228,7 @@ void k3_state::flagrall_map(address_map &map)
|
||||
k3_base_map(map);
|
||||
|
||||
map(0x3c0000, 0x3c0001).w(FUNC(k3_state::flagrall_soundbanks_w));
|
||||
map(0x4c0001, 0x4c0001).rw(m_oki1, FUNC(okim6295_device::read), FUNC(okim6295_device::write));
|
||||
map(0x4c0001, 0x4c0001).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
|
||||
}
|
||||
|
||||
|
||||
@ -366,16 +362,16 @@ static const gfx_layout k3_layout =
|
||||
16,16,
|
||||
RGN_FRAC(1,1),
|
||||
8,
|
||||
{ 0,1,2,3,4,5,6,7 },
|
||||
{ 0*8,1*8,2*8,3*8,4*8,5*8,6*8,7*8,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8 },
|
||||
{ 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128, 10*128, 11*128, 12*128, 13*128, 14*128, 15*128 },
|
||||
{ STEP8(0,1) },
|
||||
{ STEP16(0,8) },
|
||||
{ STEP16(0,8*16) },
|
||||
16*128,
|
||||
};
|
||||
|
||||
|
||||
static GFXDECODE_START( gfx_1945kiii )
|
||||
GFXDECODE_ENTRY( "gfx1", 0, k3_layout, 0x0, 2 ) /* bg tiles */
|
||||
GFXDECODE_ENTRY( "gfx2", 0, k3_layout, 0x0, 2 ) /* bg tiles */
|
||||
GFXDECODE_ENTRY( "gfx1", 0, k3_layout, 0x000, 2 ) /* sprites */
|
||||
GFXDECODE_ENTRY( "gfx2", 0, k3_layout, 0x000, 2 ) /* bg tiles */
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
@ -396,7 +392,7 @@ MACHINE_CONFIG_START(k3_state::flagrall)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(64*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(k3_state, screen_update_k3)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(k3_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 0x200)
|
||||
|
Loading…
Reference in New Issue
Block a user