dataeast/exprraid.cpp: added note about undumped revision, consolidated driver in single file

This commit is contained in:
Ivan Vangelista 2023-03-13 18:11:31 +01:00
parent cf6a0973d1
commit c0693975c8
3 changed files with 464 additions and 456 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,87 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Ernesto Corvi
/*************************************************************************
Express Raider
*************************************************************************/
#include "machine/gen_latch.h"
#include "emupal.h"
#include "tilemap.h"
class exprraid_state : public driver_device
{
public:
exprraid_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_slave(*this, "slave"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_main_ram(*this, "main_ram"),
m_spriteram(*this, "spriteram"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram")
{ }
void exprraid(machine_config &config);
void exprboot(machine_config &config);
void init_exprraid();
void init_wexpressb();
void init_wexpressb2();
void init_wexpressb3();
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted_deco16);
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted_nmi);
private:
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_slave;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
/* memory pointers */
required_shared_ptr<uint8_t> m_main_ram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
/* protection */
uint8_t m_prot_value = 0U;
/* video-related */
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
int m_bg_index[4]{};
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
void exprraid_int_clear_w(uint8_t data);
uint8_t exprraid_prot_status_r();
uint8_t exprraid_prot_data_r();
void exprraid_prot_data_w(uint8_t data);
uint8_t vblank_r();
void exprraid_videoram_w(offs_t offset, uint8_t data);
void exprraid_colorram_w(offs_t offset, uint8_t data);
void exprraid_flipscreen_w(uint8_t data);
void exprraid_bgselect_w(offs_t offset, uint8_t data);
void exprraid_scrollx_w(offs_t offset, uint8_t data);
void exprraid_scrolly_w(offs_t offset, uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update_exprraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void exprraid_gfx_expand();
void master_io_map(address_map &map);
void master_map(address_map &map);
void slave_map(address_map &map);
};

View File

@ -1,131 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Ernesto Corvi
#include "emu.h"
#include "exprraid.h"
void exprraid_state::exprraid_videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset);
}
void exprraid_state::exprraid_colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset);
}
void exprraid_state::exprraid_flipscreen_w(uint8_t data)
{
flip_screen_set(data & 0x01);
}
void exprraid_state::exprraid_bgselect_w(offs_t offset, uint8_t data)
{
if (m_bg_index[offset] != data)
{
m_bg_index[offset] = data;
m_bg_tilemap->mark_all_dirty();
}
}
void exprraid_state::exprraid_scrollx_w(offs_t offset, uint8_t data)
{
m_bg_tilemap->set_scrollx(offset, data);
}
void exprraid_state::exprraid_scrolly_w(offs_t offset, uint8_t data)
{
m_bg_tilemap->set_scrolly(0, data);
}
TILE_GET_INFO_MEMBER(exprraid_state::get_bg_tile_info)
{
uint8_t *tilerom = memregion("gfx4")->base();
int data, attr, bank, code, color, flags;
int quadrant = 0, offs;
int sx = tile_index % 32;
int sy = tile_index / 32;
if (sx >= 16) quadrant++;
if (sy >= 16) quadrant += 2;
offs = (sy % 16) * 16 + (sx % 16) + (m_bg_index[quadrant] & 0x3f) * 0x100;
data = tilerom[offs];
attr = tilerom[offs + 0x4000];
bank = (2 * (attr & 0x03) + ((data & 0x80) >> 7)) + 2;
code = data & 0x7f;
color = (attr & 0x18) >> 3;
flags = (attr & 0x04) ? TILE_FLIPX : 0;
tileinfo.category = ((attr & 0x80) ? 1 : 0);
tileinfo.set(bank, code, color, flags);
}
TILE_GET_INFO_MEMBER(exprraid_state::get_fg_tile_info)
{
int attr = m_colorram[tile_index];
int code = m_videoram[tile_index] + ((attr & 0x07) << 8);
int color = (attr & 0x10) >> 4;
tileinfo.set(0, code, color, 0);
}
void exprraid_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exprraid_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(exprraid_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_bg_tilemap->set_scroll_rows(2);
m_fg_tilemap->set_transparent_pen(0);
}
void exprraid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
int attr = m_spriteram[offs + 1];
int code = m_spriteram[offs + 3] + ((attr & 0xe0) << 3);
int color = (attr & 0x03) + ((attr & 0x08) >> 1);
int flipx = (attr & 0x04);
int flipy = 0;
int sx = ((248 - m_spriteram[offs + 2]) & 0xff) - 8;
int sy = m_spriteram[offs];
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
code, color,
flipx, flipy,
sx, sy, 0);
// double height
if (attr & 0x10)
{
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
code + 1, color,
flipx, flipy,
sx, sy + (flip_screen() ? -16 : 16), 0);
}
}
}
uint32_t exprraid_state::screen_update_exprraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(screen, bitmap, cliprect, 1, 0);
m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}