Modernization of drivers part 7 (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2013-02-08 12:49:41 +00:00
parent d27fc2f750
commit 6388331fec
25 changed files with 322 additions and 321 deletions

View File

@ -126,22 +126,21 @@ UINT32 hitme_state::screen_update_barricad(screen_device &screen, bitmap_ind16 &
*
*************************************/
static UINT8 read_port_and_t0( running_machine &machine, int port )
UINT8 hitme_state::read_port_and_t0( int port )
{
hitme_state *state = machine.driver_data<hitme_state>();
static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
UINT8 val = machine.root_device().ioport(portnames[port])->read();
if (machine.time() > state->m_timeout_time)
UINT8 val = machine().root_device().ioport(portnames[port])->read();
if (machine().time() > m_timeout_time)
val ^= 0x80;
return val;
}
static UINT8 read_port_and_t0_and_hblank( running_machine &machine, int port )
UINT8 hitme_state::read_port_and_t0_and_hblank( int port )
{
UINT8 val = read_port_and_t0(machine, port);
if (machine.primary_screen->hpos() < (machine.primary_screen->width() * 9 / 10))
UINT8 val = read_port_and_t0(port);
if (machine().primary_screen->hpos() < (machine().primary_screen->width() * 9 / 10))
val ^= 0x04;
return val;
}
@ -149,25 +148,25 @@ static UINT8 read_port_and_t0_and_hblank( running_machine &machine, int port )
READ8_MEMBER(hitme_state::hitme_port_0_r)
{
return read_port_and_t0_and_hblank(machine(), 0);
return read_port_and_t0_and_hblank(0);
}
READ8_MEMBER(hitme_state::hitme_port_1_r)
{
return read_port_and_t0(machine(), 1);
return read_port_and_t0(1);
}
READ8_MEMBER(hitme_state::hitme_port_2_r)
{
return read_port_and_t0_and_hblank(machine(), 2);
return read_port_and_t0_and_hblank(2);
}
READ8_MEMBER(hitme_state::hitme_port_3_r)
{
return read_port_and_t0(machine(), 3);
return read_port_and_t0(3);
}

View File

@ -45,12 +45,11 @@ fix comms so it boots, it's a bit of a hack for hyperduel at the moment ;-)
Interrupts
***************************************************************************/
static void update_irq_state( running_machine &machine )
void hyprduel_state::update_irq_state( )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
int irq = state->m_requested_int & ~*state->m_irq_enable;
int irq = m_requested_int & ~*m_irq_enable;
state->m_maincpu->set_input_line(3, (irq & state->m_int_num) ? ASSERT_LINE : CLEAR_LINE);
m_maincpu->set_input_line(3, (irq & m_int_num) ? ASSERT_LINE : CLEAR_LINE);
}
TIMER_CALLBACK_MEMBER(hyprduel_state::vblank_end_callback)
@ -73,7 +72,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(hyprduel_state::hyprduel_interrupt)
else
m_requested_int |= 0x12; /* hsync */
update_irq_state(machine());
update_irq_state();
}
READ16_MEMBER(hyprduel_state::hyprduel_irq_cause_r)
@ -90,7 +89,7 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_irq_cause_w)
else
m_requested_int &= ~(data & *m_irq_enable);
update_irq_state(machine());
update_irq_state();
}
}
@ -255,10 +254,10 @@ READ16_MEMBER(hyprduel_state::hyprduel_bankedrom_r)
TIMER_CALLBACK_MEMBER(hyprduel_state::hyprduel_blit_done)
{
m_requested_int |= 1 << m_blitter_bit;
update_irq_state(machine());
update_irq_state();
}
INLINE int blt_read( const UINT8 *ROM, const int offs )
inline int hyprduel_state::blt_read( const UINT8 *ROM, const int offs )
{
return ROM[offs];
}

View File

@ -56,4 +56,6 @@ public:
virtual void video_start();
virtual void palette_init();
UINT32 screen_update_hcastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void set_pens();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sbank, int bank );
};

View File

@ -24,4 +24,5 @@ public:
virtual void video_start();
UINT32 screen_update_hexion(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(hexion_scanline);
inline void get_tile_info(tile_data &tileinfo,int tile_index,UINT8 *ram);
};

View File

@ -28,4 +28,5 @@ public:
virtual void palette_init();
UINT32 screen_update_higemaru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(higemaru_scanline);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};

View File

@ -34,4 +34,5 @@ public:
virtual void machine_reset();
virtual void video_start();
UINT32 screen_update_himesiki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};

View File

@ -41,6 +41,8 @@ public:
DECLARE_VIDEO_START(barricad);
UINT32 screen_update_hitme(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_barricad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT8 read_port_and_t0( int port );
UINT8 read_port_and_t0_and_hblank( int port );
};

View File

@ -37,4 +37,7 @@ public:
virtual void video_start();
DECLARE_VIDEO_START(untoucha);
UINT32 screen_update_hnayayoi(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void common_vh_start( int num_pixmaps );
void copy_pixel( int x, int y, int pen );
void draw_layer_interleaved( bitmap_ind16 &bitmap, const rectangle &cliprect, int left_pixmap, int right_pixmap, int palbase, int transp );
};

View File

@ -33,4 +33,6 @@ public:
DECLARE_VIDEO_START(crzrally);
UINT32 screen_update_holeland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_crzrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void holeland_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void crzrally_draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
};

View File

@ -127,4 +127,14 @@ public:
void screen_eof_homedata(screen_device &screen, bool state);
INTERRUPT_GEN_MEMBER(homedata_irq);
INTERRUPT_GEN_MEMBER(upd7807_irq);
void mrokumei_handleblit( address_space &space, int rom_base );
void reikaids_handleblit( address_space &space, int rom_base );
void pteacher_handleblit( address_space &space, int rom_base );
inline void mrokumei_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank );
inline void mrokumei_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank );
inline void reikaids_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank );
inline void pteacher_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank );
inline void lemnangl_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxset, int gfxbank );
inline void mirderby_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank );
inline void mirderby_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank );
};

View File

@ -54,4 +54,5 @@ public:
virtual void video_start();
UINT32 screen_update_homerun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(homerun_banking_w);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};

View File

@ -25,4 +25,5 @@ public:
virtual void video_start();
UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(blitter_timer_callback);
void hyhoo_gfxdraw();
};

View File

@ -44,4 +44,5 @@ public:
DECLARE_VIDEO_START(roadf);
UINT32 screen_update_hyperspt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};

View File

@ -95,4 +95,15 @@ public:
TIMER_CALLBACK_MEMBER(hyprduel_blit_done);
TIMER_DEVICE_CALLBACK_MEMBER(hyprduel_interrupt);
void hyprduel_postload();
inline void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram);
inline void get_tile_info_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram );
inline void get_tile_info_16x16_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram );
inline void hyprduel_vram_w( offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram );
void alloc_empty_tiles( );
void expand_gfx1(hyprduel_state &state);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_layers( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl );
void dirty_tiles( int layer, UINT16 *vram );
void update_irq_state( );
inline int blt_read( const UINT8 *ROM, const int offs );
};

View File

@ -42,18 +42,17 @@ void hcastle_state::palette_init()
}
static void set_pens(running_machine &machine)
void hcastle_state::set_pens()
{
hcastle_state *state = machine.driver_data<hcastle_state>();
int i;
for (i = 0x00; i < 0x100; i += 2)
{
UINT16 data = state->m_paletteram[i | 1] | (state->m_paletteram[i] << 8);
UINT16 data = m_paletteram[i | 1] | (m_paletteram[i] << 8);
rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
colortable_palette_set_color(machine.colortable, i >> 1, color);
colortable_palette_set_color(machine().colortable, i >> 1, color);
}
}
@ -199,15 +198,14 @@ WRITE8_MEMBER(hcastle_state::hcastle_pf2_control_w)
/*****************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sbank, int bank )
void hcastle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sbank, int bank )
{
hcastle_state *state = machine.driver_data<hcastle_state>();
device_t *k007121 = bank ? state->m_k007121_2 : state->m_k007121_1;
address_space &space = machine.driver_data()->generic_space();
device_t *k007121 = bank ? m_k007121_2 : m_k007121_1;
address_space &space = machine().driver_data()->generic_space();
int base_color = (k007121_ctrlram_r(k007121, space, 6) & 0x30) * 2;
int bank_base = (bank == 0) ? 0x4000 * (state->m_gfx_bank & 1) : 0;
int bank_base = (bank == 0) ? 0x4000 * (m_gfx_bank & 1) : 0;
k007121_sprites_draw(k007121, bitmap, cliprect, machine.gfx[bank], machine.colortable, sbank, base_color, 0, bank_base, (UINT32)-1);
k007121_sprites_draw(k007121, bitmap, cliprect, machine().gfx[bank], machine().colortable, sbank, base_color, 0, bank_base, (UINT32)-1);
}
/*****************************************************************************/
@ -225,7 +223,7 @@ UINT32 hcastle_state::screen_update_hcastle(screen_device &screen, bitmap_ind16
UINT8 ctrl_2_2 = k007121_ctrlram_r(m_k007121_2, space, 2);
UINT8 ctrl_2_3 = k007121_ctrlram_r(m_k007121_2, space, 3);
set_pens(machine());
set_pens();
m_pf1_bankbase = 0x0000;
m_pf2_bankbase = 0x4000 * ((m_gfx_bank & 2) >> 1);
@ -254,16 +252,16 @@ UINT32 hcastle_state::screen_update_hcastle(screen_device &screen, bitmap_ind16
if ((m_gfx_bank & 0x04) == 0)
{
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, m_spriteram->buffer(), 0);
draw_sprites(machine(), bitmap, cliprect, m_spriteram2->buffer(), 1);
draw_sprites(bitmap, cliprect, m_spriteram->buffer(), 0);
draw_sprites(bitmap, cliprect, m_spriteram2->buffer(), 1);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
}
else
{
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, m_spriteram->buffer(), 0);
draw_sprites(machine(), bitmap, cliprect, m_spriteram2->buffer(), 1);
draw_sprites(bitmap, cliprect, m_spriteram->buffer(), 0);
draw_sprites(bitmap, cliprect, m_spriteram2->buffer(), 1);
}
return 0;
}

View File

@ -10,10 +10,10 @@
***************************************************************************/
INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,UINT8 *ram)
inline void hexion_state::get_tile_info(tile_data &tileinfo,int tile_index,UINT8 *ram)
{
tile_index *= 4;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
0,
ram[tile_index] + ((ram[tile_index+1] & 0x3f) << 8),
ram[tile_index+2] & 0x0f,
@ -22,12 +22,12 @@ INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_
TILE_GET_INFO_MEMBER(hexion_state::get_tile_info0)
{
get_tile_info(machine(),tileinfo,tile_index,m_vram[0]);
get_tile_info(tileinfo,tile_index,m_vram[0]);
}
TILE_GET_INFO_MEMBER(hexion_state::get_tile_info1)
{
get_tile_info(machine(),tileinfo,tile_index,m_vram[1]);
get_tile_info(tileinfo,tile_index,m_vram[1]);
}

View File

@ -102,13 +102,12 @@ void higemaru_state::video_start()
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(higemaru_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void higemaru_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
higemaru_state *state = machine.driver_data<higemaru_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram = m_spriteram;
int offs;
for (offs = state->m_spriteram.bytes() - 16; offs >= 0; offs -= 16)
for (offs = m_spriteram.bytes() - 16; offs >= 0; offs -= 16)
{
int code,col,sx,sy,flipx,flipy;
@ -118,7 +117,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
sy = spriteram[offs + 8];
flipx = spriteram[offs + 4] & 0x10;
flipy = spriteram[offs + 4] & 0x20;
if (state->flip_screen())
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
@ -126,14 +125,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
flipy = !flipy;
}
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code,
col,
flipx,flipy,
sx,sy,15);
/* draw again with wraparound */
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code,
col,
flipx,flipy,
@ -144,6 +143,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
UINT32 higemaru_state::screen_update_higemaru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -45,10 +45,9 @@ WRITE8_MEMBER(himesiki_state::himesiki_flip_w)
logerror("p08_w %02x\n",data);
}
static void himesiki_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void himesiki_state::himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
himesiki_state *state = machine.driver_data<himesiki_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram = m_spriteram;
int offs;
for (offs = 0x100; offs < 0x160; offs += 4)
@ -65,7 +64,7 @@ static void himesiki_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
if (x > 0x1e0)
x -= 0x200;
if (state->m_flipscreen)
if (m_flipscreen)
{
y = (y + 33) & 0xff;
x = 224 - x;
@ -79,7 +78,7 @@ static void himesiki_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
y -= 0x100;
}
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, col, fx, fy, x, y, 15);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, col, fx, fy, x, y, 15);
}
for (offs = 0; offs < 0x100; offs += 4)
@ -95,7 +94,7 @@ static void himesiki_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
if (x > 0x1e0)
x -= 0x200;
if (state->m_flipscreen)
if (m_flipscreen)
{
y += 49;
x = 240 - x;
@ -108,7 +107,7 @@ static void himesiki_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
if (y > 0xf0)
y -= 0x100;
drawgfx_transpen(bitmap, cliprect, machine.gfx[2], code, col, f, f, x, y, 15);
drawgfx_transpen(bitmap, cliprect, machine().gfx[2], code, col, f, f, x, y, 15);
}
}
@ -118,7 +117,7 @@ UINT32 himesiki_state::screen_update_himesiki(screen_device &screen, bitmap_ind1
m_bg_tilemap->set_scrolldx(x, x);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
himesiki_draw_sprites(machine(), bitmap, cliprect);
himesiki_draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -12,27 +12,26 @@ The blitter reads compressed data from ROM and copies it to the bitmap RAM.
#include "emu.h"
#include "includes/hnayayoi.h"
static void common_vh_start( running_machine &machine, int num_pixmaps )
void hnayayoi_state::common_vh_start( int num_pixmaps )
{
hnayayoi_state *state = machine.driver_data<hnayayoi_state>();
int i;
state->m_total_pixmaps = num_pixmaps;
m_total_pixmaps = num_pixmaps;
for (i = 0; i < 8; i++)
{
if (i < state->m_total_pixmaps)
if (i < m_total_pixmaps)
{
state->m_pixmap[i] = auto_alloc_array(machine, UINT8, 256 * 256);
m_pixmap[i] = auto_alloc_array(machine(), UINT8, 256 * 256);
}
else
state->m_pixmap[i] = NULL;
m_pixmap[i] = NULL;
}
}
void hnayayoi_state::video_start()
{
common_vh_start(machine(), 4); /* 4 bitmaps -> 2 layers */
common_vh_start(4); /* 4 bitmaps -> 2 layers */
save_pointer(NAME(m_pixmap[0]), 256 * 256);
save_pointer(NAME(m_pixmap[1]), 256 * 256);
@ -42,7 +41,7 @@ void hnayayoi_state::video_start()
VIDEO_START_MEMBER(hnayayoi_state,untoucha)
{
common_vh_start(machine(), 8); /* 8 bitmaps -> 4 layers */
common_vh_start(8); /* 8 bitmaps -> 4 layers */
save_pointer(NAME(m_pixmap[0]), 256 * 256);
save_pointer(NAME(m_pixmap[1]), 256 * 256);
@ -111,17 +110,16 @@ WRITE8_MEMBER(hnayayoi_state::dynax_blitter_rev1_param_w)
}
}
static void copy_pixel( running_machine &machine, int x, int y, int pen )
void hnayayoi_state::copy_pixel( int x, int y, int pen )
{
hnayayoi_state *state = machine.driver_data<hnayayoi_state>();
if (x >= 0 && x <= 255 && y >= 0 && y <= 255)
{
int i;
for (i = 0; i < 8; i++)
{
if ((~state->m_blit_layer & (1 << i)) && (state->m_pixmap[i]))
state->m_pixmap[i][256 * y + x] = pen;
if ((~m_blit_layer & (1 << i)) && (m_pixmap[i]))
m_pixmap[i][256 * y + x] = pen;
}
}
}
@ -190,7 +188,7 @@ WRITE8_MEMBER(hnayayoi_state::dynax_blitter_rev1_start_w)
case 0x2:
case 0x1:
while (cmd--)
copy_pixel(machine(), x++, y, pen);
copy_pixel(x++, y, pen);
break;
case 0x0:
@ -221,12 +219,11 @@ WRITE8_MEMBER(hnayayoi_state::hnayayoi_palbank_w)
}
static void draw_layer_interleaved( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int left_pixmap, int right_pixmap, int palbase, int transp )
void hnayayoi_state::draw_layer_interleaved( bitmap_ind16 &bitmap, const rectangle &cliprect, int left_pixmap, int right_pixmap, int palbase, int transp )
{
hnayayoi_state *state = machine.driver_data<hnayayoi_state>();
int county, countx, pen;
UINT8 *src1 = state->m_pixmap[left_pixmap];
UINT8 *src2 = state->m_pixmap[right_pixmap];
UINT8 *src1 = m_pixmap[left_pixmap];
UINT8 *src2 = m_pixmap[right_pixmap];
UINT16 *dstbase = &bitmap.pix16(0);
palbase *= 16;
@ -266,15 +263,15 @@ UINT32 hnayayoi_state::screen_update_hnayayoi(screen_device &screen, bitmap_ind1
if (m_total_pixmaps == 4)
{
draw_layer_interleaved(machine(), bitmap, cliprect, 3, 2, col1, 0);
draw_layer_interleaved(machine(), bitmap, cliprect, 1, 0, col0, 1);
draw_layer_interleaved(bitmap, cliprect, 3, 2, col1, 0);
draw_layer_interleaved(bitmap, cliprect, 1, 0, col0, 1);
}
else /* total_pixmaps == 8 */
{
draw_layer_interleaved(machine(), bitmap, cliprect, 7, 6, col3, 0);
draw_layer_interleaved(machine(), bitmap, cliprect, 5, 4, col2, 1);
draw_layer_interleaved(machine(), bitmap, cliprect, 3, 2, col1, 1);
draw_layer_interleaved(machine(), bitmap, cliprect, 1, 0, col0, 1);
draw_layer_interleaved(bitmap, cliprect, 7, 6, col3, 0);
draw_layer_interleaved(bitmap, cliprect, 5, 4, col2, 1);
draw_layer_interleaved(bitmap, cliprect, 3, 2, col1, 1);
draw_layer_interleaved(bitmap, cliprect, 1, 0, col0, 1);
}
return 0;
}

View File

@ -101,39 +101,38 @@ WRITE8_MEMBER(holeland_state::holeland_flipscreen_w)
}
static void holeland_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void holeland_state::holeland_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
holeland_state *state = machine.driver_data<holeland_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram = m_spriteram;
int offs, code, sx, sy, color, flipx, flipy;
/* Weird, sprites entries don't start on DWORD boundary */
for (offs = 3; offs < state->m_spriteram.bytes() - 1; offs += 4)
for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4)
{
sy = 236 - spriteram[offs];
sx = spriteram[offs + 2];
/* Bit 7 unknown */
code = spriteram[offs + 1] & 0x7f;
color = state->m_palette_offset + (spriteram[offs + 3] >> 4);
color = m_palette_offset + (spriteram[offs + 3] >> 4);
/* Bit 0, 1 unknown */
flipx = spriteram[offs + 3] & 0x04;
flipy = spriteram[offs + 3] & 0x08;
if (state->flip_screen_x())
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (state->flip_screen_y())
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code,
color,
flipx,flipy,
@ -141,14 +140,13 @@ static void holeland_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
}
}
static void crzrally_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
void holeland_state::crzrally_draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
{
holeland_state *state = machine.driver_data<holeland_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram = m_spriteram;
int offs, code, sx, sy, color, flipx, flipy;
/* Weird, sprites entries don't start on DWORD boundary */
for (offs = 3; offs < state->m_spriteram.bytes() - 1; offs += 4)
for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4)
{
sy = 236 - spriteram[offs];
sx = spriteram[offs + 2];
@ -160,19 +158,19 @@ static void crzrally_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
flipx = spriteram[offs + 3] & 0x04;
flipy = spriteram[offs + 3] & 0x08;
if (state->flip_screen_x())
if (flip_screen_x())
{
flipx = !flipx;
sx = 240 - sx;
}
if (state->flip_screen_y())
if (flip_screen_y())
{
flipy = !flipy;
sy = 240 - sy;
}
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code,
color,
flipx,flipy,
@ -184,7 +182,7 @@ UINT32 holeland_state::screen_update_holeland(screen_device &screen, bitmap_ind1
{
/*m_bg_tilemap->mark_all_dirty(); */
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
holeland_draw_sprites(machine(), bitmap, cliprect);
holeland_draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
return 0;
}
@ -192,6 +190,6 @@ UINT32 holeland_state::screen_update_holeland(screen_device &screen, bitmap_ind1
UINT32 holeland_state::screen_update_crzrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
crzrally_draw_sprites(machine(), bitmap, cliprect);
crzrally_draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -32,22 +32,21 @@
***************************************************************************/
static void mrokumei_handleblit( address_space &space, int rom_base )
void homedata_state::mrokumei_handleblit( address_space &space, int rom_base )
{
homedata_state *state = space.machine().driver_data<homedata_state>();
int i;
int dest_param;
int source_addr;
int dest_addr;
int base_addr;
int opcode, data, num_tiles;
UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
UINT8 *pBlitData = memregion("user1")->base() + rom_base;
dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
dest_param = m_blitter_param[(m_blitter_param_count - 4) & 3] * 256 +
m_blitter_param[(m_blitter_param_count - 3) & 3];
source_addr = state->m_blitter_param[(state->m_blitter_param_count - 2) & 3] * 256 +
state->m_blitter_param[(state->m_blitter_param_count - 1) & 3];
source_addr = m_blitter_param[(m_blitter_param_count - 2) & 3] * 256 +
m_blitter_param[(m_blitter_param_count - 1) & 3];
/* xxx-.----.----.---- not used?
* ---x.----.----.---- layer
@ -58,7 +57,7 @@ static void mrokumei_handleblit( address_space &space, int rom_base )
// logerror( "[blit bank %02x src %04x dst %04x]\n", blitter_bank, source_addr, dest_param);
if( state->m_visible_page == 0 )
if( m_visible_page == 0 )
{
base_addr += 0x2000;
}
@ -99,9 +98,9 @@ static void mrokumei_handleblit( address_space &space, int rom_base )
} /* i!=0 */
if (data) /* 00 is a nop */
state->mrokumei_videoram_w(space, base_addr + dest_addr, data);
mrokumei_videoram_w(space, base_addr + dest_addr, data);
if (state->m_vreg[1] & 0x80) /* flip screen */
if (m_vreg[1] & 0x80) /* flip screen */
{
dest_addr -= 2;
if (dest_addr < 0)
@ -116,26 +115,25 @@ static void mrokumei_handleblit( address_space &space, int rom_base )
} /* for(;;) */
finish:
state->m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
}
static void reikaids_handleblit( address_space &space, int rom_base )
void homedata_state::reikaids_handleblit( address_space &space, int rom_base )
{
homedata_state *state = space.machine().driver_data<homedata_state>();
int i;
UINT16 dest_param;
int flipx;
int source_addr, base_addr;
int dest_addr;
UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
UINT8 *pBlitData = memregion("user1")->base() + rom_base;
int opcode, data, num_tiles;
dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
dest_param = m_blitter_param[(m_blitter_param_count - 4) & 3] * 256 +
m_blitter_param[(m_blitter_param_count - 3) & 3];
source_addr = state->m_blitter_param[(state->m_blitter_param_count - 2) & 3] * 256 +
state->m_blitter_param[(state->m_blitter_param_count - 1) & 3];
source_addr = m_blitter_param[(m_blitter_param_count - 2) & 3] * 256 +
m_blitter_param[(m_blitter_param_count - 1) & 3];
/* x---.----.----.---- flipx
* -x--.----.----.---- select: attr/tile
@ -147,7 +145,7 @@ static void reikaids_handleblit( address_space &space, int rom_base )
// logerror( "[blit %02x %04x %04x]\n",blitter_bank,source_addr,dest_param);
if (state->m_visible_page == 0)
if (m_visible_page == 0)
base_addr += 0x2000 << 2;
for(;;)
@ -202,11 +200,11 @@ static void reikaids_handleblit( address_space &space, int rom_base )
addr ^= 0x007c;
}
state->reikaids_videoram_w(space, addr, dat);
reikaids_videoram_w(space, addr, dat);
}
}
if (state->m_vreg[1] & 0x80) /* flip screen */
if (m_vreg[1] & 0x80) /* flip screen */
dest_addr-=4;
else
dest_addr+=4;
@ -214,24 +212,23 @@ static void reikaids_handleblit( address_space &space, int rom_base )
}
finish:
state->m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
}
static void pteacher_handleblit( address_space &space, int rom_base )
void homedata_state::pteacher_handleblit( address_space &space, int rom_base )
{
homedata_state *state = space.machine().driver_data<homedata_state>();
int i;
int dest_param;
int source_addr;
int dest_addr, base_addr;
int opcode, data, num_tiles;
UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
UINT8 *pBlitData = memregion("user1")->base() + rom_base;
dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
dest_param = m_blitter_param[(m_blitter_param_count - 4) & 3] * 256 +
m_blitter_param[(m_blitter_param_count - 3) & 3];
source_addr = state->m_blitter_param[(state->m_blitter_param_count - 2) & 3] * 256 +
state->m_blitter_param[(state->m_blitter_param_count - 1) & 3];
source_addr = m_blitter_param[(m_blitter_param_count - 2) & 3] * 256 +
m_blitter_param[(m_blitter_param_count - 1) & 3];
/* x---.----.----.---- not used?
* -x--.----.----.---- layer (0..1)
@ -242,7 +239,7 @@ static void pteacher_handleblit( address_space &space, int rom_base )
// logerror( "[blit %02x %04x %04x]->%d\n",blitter_bank,source_addr,dest_param,homedata_visible_page);
if (state->m_visible_page == 0)
if (m_visible_page == 0)
{
base_addr += 0x2000 << 2;
}
@ -289,11 +286,11 @@ static void pteacher_handleblit( address_space &space, int rom_base )
if ((addr & 0x2080) == 0)
{
addr = ((addr & 0xc000) >> 2) | ((addr & 0x1f00) >> 1) | (addr & 0x7f);
state->mrokumei_videoram_w(space, addr, data);
mrokumei_videoram_w(space, addr, data);
}
}
if (state->m_vreg[1] & 0x80) /* flip screen */
if (m_vreg[1] & 0x80) /* flip screen */
dest_addr -= 2;
else
dest_addr += 2;
@ -301,7 +298,7 @@ static void pteacher_handleblit( address_space &space, int rom_base )
} /* for(;;) */
finish:
state->m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
}
@ -404,60 +401,57 @@ PALETTE_INIT_MEMBER(homedata_state,mirderby)
***************************************************************************/
INLINE void mrokumei_info0( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
inline void homedata_state::mrokumei_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank )
{
homedata_state *state = machine.driver_data<homedata_state>();
int addr = tile_index * 2 + 0x2000 * page;
int attr = state->m_videoram[addr];
int code = state->m_videoram[addr + 1] + ((attr & 0x03) << 8) + (gfxbank << 10);
int attr = m_videoram[addr];
int code = m_videoram[addr + 1] + ((attr & 0x03) << 8) + (gfxbank << 10);
int color = (attr >> 2) + (gfxbank << 6);
SET_TILE_INFO( 0, code, color, state->m_flipscreen );
SET_TILE_INFO_MEMBER( 0, code, color, m_flipscreen );
}
INLINE void mrokumei_info1( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
inline void homedata_state::mrokumei_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank )
{
homedata_state *state = machine.driver_data<homedata_state>();
int addr = tile_index * 2 + 0x1000 + 0x2000 * page;
int attr = state->m_videoram[addr];
int code = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
int attr = m_videoram[addr];
int code = m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
int color = (attr >> 3) + ((gfxbank & 3) << 6);
SET_TILE_INFO( 1, code, color, state->m_flipscreen );
SET_TILE_INFO_MEMBER( 1, code, color, m_flipscreen );
}
TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info0_0)
{
mrokumei_info0( machine(), tileinfo, tile_index, 0, m_blitter_bank & 0x03 );
mrokumei_info0(tileinfo, tile_index, 0, m_blitter_bank & 0x03 );
}
TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info1_0)
{
mrokumei_info0( machine(), tileinfo, tile_index, 1, m_blitter_bank & 0x03 );
mrokumei_info0(tileinfo, tile_index, 1, m_blitter_bank & 0x03 );
}
TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info0_1)
{
mrokumei_info1( machine(), tileinfo, tile_index, 0, (m_blitter_bank & 0x38) >> 3 );
mrokumei_info1(tileinfo, tile_index, 0, (m_blitter_bank & 0x38) >> 3 );
}
TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info1_1)
{
mrokumei_info1( machine(), tileinfo, tile_index, 1, (m_blitter_bank & 0x38) >> 3 );
mrokumei_info1(tileinfo, tile_index, 1, (m_blitter_bank & 0x38) >> 3 );
}
INLINE void reikaids_info( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
inline void homedata_state::reikaids_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
{
homedata_state *state = machine.driver_data<homedata_state>();
int addr = tile_index * 4 + layer + 0x2000 * page;
int attr = state->m_videoram[addr];
int code = state->m_videoram[addr + 0x1000] + ((attr & 0x03) << 8) + (gfxbank << 10);
int attr = m_videoram[addr];
int code = m_videoram[addr + 0x1000] + ((attr & 0x03) << 8) + (gfxbank << 10);
int color = (attr & 0x7c) >> 2;
int flags = state->m_flipscreen;
int flags = m_flipscreen;
if (attr & 0x80) flags ^= TILE_FLIPX;
SET_TILE_INFO( layer, code, color, flags );
SET_TILE_INFO_MEMBER( layer, code, color, flags );
}
/* reikaids_gfx_bank[0]:
@ -470,149 +464,145 @@ INLINE void reikaids_info( running_machine &machine, tile_data &tileinfo, int ti
*/
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_0)
{
reikaids_info(machine(), tileinfo, tile_index, 0, 0, (m_gfx_bank[1] >> 3));
reikaids_info(tileinfo, tile_index, 0, 0, (m_gfx_bank[1] >> 3));
}
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_0)
{
reikaids_info(machine(), tileinfo, tile_index, 1, 0, (m_gfx_bank[1] >> 3));
reikaids_info(tileinfo, tile_index, 1, 0, (m_gfx_bank[1] >> 3));
}
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_1)
{
reikaids_info(machine(), tileinfo, tile_index, 0, 1, ((m_gfx_bank[0] & 0x78) >> 3));
reikaids_info(tileinfo, tile_index, 0, 1, ((m_gfx_bank[0] & 0x78) >> 3));
}
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_1)
{
reikaids_info(machine(), tileinfo, tile_index, 1, 1, ((m_gfx_bank[0] & 0x78) >> 3));
reikaids_info(tileinfo, tile_index, 1, 1, ((m_gfx_bank[0] & 0x78) >> 3));
}
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_2)
{
reikaids_info(machine(), tileinfo, tile_index, 0, 2, (m_gfx_bank[1] & 0x7));
reikaids_info(tileinfo, tile_index, 0, 2, (m_gfx_bank[1] & 0x7));
}
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_2)
{
reikaids_info(machine(), tileinfo, tile_index, 1, 2, (m_gfx_bank[1] & 0x7));
reikaids_info(tileinfo, tile_index, 1, 2, (m_gfx_bank[1] & 0x7));
}
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_3)
{
reikaids_info(machine(), tileinfo, tile_index, 0, 3, (m_gfx_bank[0] & 0x7));
reikaids_info(tileinfo, tile_index, 0, 3, (m_gfx_bank[0] & 0x7));
}
TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_3)
{
reikaids_info(machine(), tileinfo, tile_index, 1, 3, (m_gfx_bank[0] & 0x7));
reikaids_info(tileinfo, tile_index, 1, 3, (m_gfx_bank[0] & 0x7));
}
INLINE void pteacher_info( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
inline void homedata_state::pteacher_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
{
homedata_state *state = machine.driver_data<homedata_state>();
int addr = tile_index * 2 + 0x1000 * layer + 0x2000 * page;
int attr = state->m_videoram[addr];
int code = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
int attr = m_videoram[addr];
int code = m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
int color = (attr >> 3) + ((gfxbank & 1) << 5);
SET_TILE_INFO(layer, code, color, state->m_flipscreen);
SET_TILE_INFO_MEMBER(layer, code, color, m_flipscreen);
}
TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info0_0)
{
pteacher_info(machine(), tileinfo, tile_index, 0, 0, m_gfx_bank[0] & 0x0f);
pteacher_info(tileinfo, tile_index, 0, 0, m_gfx_bank[0] & 0x0f);
}
TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info1_0)
{
pteacher_info(machine(), tileinfo, tile_index, 1, 0, m_gfx_bank[0] & 0x0f);
pteacher_info(tileinfo, tile_index, 1, 0, m_gfx_bank[0] & 0x0f);
}
TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info0_1)
{
pteacher_info(machine(), tileinfo, tile_index, 0, 1, m_gfx_bank[0] >> 4);
pteacher_info(tileinfo, tile_index, 0, 1, m_gfx_bank[0] >> 4);
}
TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info1_1)
{
pteacher_info(machine(), tileinfo, tile_index, 1, 1, m_gfx_bank[0] >> 4);
pteacher_info(tileinfo, tile_index, 1, 1, m_gfx_bank[0] >> 4);
}
INLINE void lemnangl_info( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int layer, int gfxset, int gfxbank )
inline void homedata_state::lemnangl_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxset, int gfxbank )
{
homedata_state *state = machine.driver_data<homedata_state>();
int addr = tile_index * 2 + 0x1000 * layer + 0x2000 * page;
int attr = state->m_videoram[addr];
int code = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
int attr = m_videoram[addr];
int code = m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
int color = 16 * (attr >> 3) + gfxbank;
SET_TILE_INFO(2 * layer + gfxset, code, color, state->m_flipscreen);
SET_TILE_INFO_MEMBER(2 * layer + gfxset, code, color, m_flipscreen);
}
TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info0_0)
{
lemnangl_info( machine(), tileinfo, tile_index, 0, 0, m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
lemnangl_info(tileinfo, tile_index, 0, 0, m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
}
TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info1_0)
{
lemnangl_info( machine(), tileinfo, tile_index, 1, 0, m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
lemnangl_info(tileinfo, tile_index, 1, 0, m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
}
TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info0_1)
{
lemnangl_info( machine(), tileinfo, tile_index, 0, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
lemnangl_info(tileinfo, tile_index, 0, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
}
TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info1_1)
{
lemnangl_info( machine(), tileinfo, tile_index, 1, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
lemnangl_info(tileinfo, tile_index, 1, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
}
INLINE void mirderby_info0( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
inline void homedata_state::mirderby_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank )
{
homedata_state *state = machine.driver_data<homedata_state>();
int addr = tile_index * 2 + 0x2000 * page;
int attr = state->m_videoram[addr];
int code = state->m_videoram[addr + 1] + ((attr & 0x03) << 8) + 0x400;// + (gfxbank << 10);
int attr = m_videoram[addr];
int code = m_videoram[addr + 1] + ((attr & 0x03) << 8) + 0x400;// + (gfxbank << 10);
int color = (attr >> 2) + (gfxbank << 6);
SET_TILE_INFO( 0, code, color, state->m_flipscreen );
SET_TILE_INFO_MEMBER( 0, code, color, m_flipscreen );
}
INLINE void mirderby_info1( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
inline void homedata_state::mirderby_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank )
{
homedata_state *state = machine.driver_data<homedata_state>();
int addr = tile_index * 2 + 0x1000 + 0x2000 * page;
int attr = state->m_videoram[addr];
int code = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + 0x400;//(gfxbank << 11);
int attr = m_videoram[addr];
int code = m_videoram[addr + 1] + ((attr & 0x07) << 8) + 0x400;//(gfxbank << 11);
int color = (attr >> 3) + ((gfxbank & 3) << 6);
SET_TILE_INFO( 1, code, color, state->m_flipscreen );
SET_TILE_INFO_MEMBER( 1, code, color, m_flipscreen );
}
TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info0_0)
{
mirderby_info0( machine(), tileinfo, tile_index, 0, 0);// m_blitter_bank & 0x03 );
mirderby_info0(tileinfo, tile_index, 0, 0);// m_blitter_bank & 0x03 );
}
TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info1_0)
{
mirderby_info0( machine(), tileinfo, tile_index, 1, 0);// m_blitter_bank & 0x03 );
mirderby_info0(tileinfo, tile_index, 1, 0);// m_blitter_bank & 0x03 );
}
TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info0_1)
{
mirderby_info1( machine(), tileinfo, tile_index, 0, 0);//(m_blitter_bank & 0x38) >> 3 );
mirderby_info1(tileinfo, tile_index, 0, 0);//(m_blitter_bank & 0x38) >> 3 );
}
TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info1_1)
{
mirderby_info1( machine(), tileinfo, tile_index, 1, 0);//(m_blitter_bank & 0x38) >> 3 );
mirderby_info1(tileinfo, tile_index, 1, 0);//(m_blitter_bank & 0x38) >> 3 );
}

View File

@ -108,29 +108,28 @@ void homerun_state::video_start()
}
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void homerun_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
homerun_state *state = machine.driver_data<homerun_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram = m_spriteram;
int offs;
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int sx = spriteram[offs + 3];
int sy = spriteram[offs + 0] - 15;
int code = (spriteram[offs + 1]) | ((spriteram[offs + 2] & 0x8) << 5) | ((state->m_gfx_ctrl & 3) << 9);
int code = (spriteram[offs + 1]) | ((spriteram[offs + 2] & 0x8) << 5) | ((m_gfx_ctrl & 3) << 9);
int color = (spriteram[offs + 2] & 0x07) | 8;
int flipx = (spriteram[offs + 2] & 0x40) >> 6;
int flipy = (spriteram[offs + 2] & 0x80) >> 7;
drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
drawgfx_transpen(bitmap, cliprect, machine().gfx[1],
code,
color,
flipx,flipy,
sx,sy,0);
// wraparound
drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
drawgfx_transpen(bitmap, cliprect, machine().gfx[1],
code,
color,
flipx,flipy,
@ -144,7 +143,7 @@ UINT32 homerun_state::screen_update_homerun(screen_device &screen, bitmap_ind16
m_tilemap->set_scrollx(0, m_scrollx);
m_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -11,9 +11,6 @@
#include "includes/hyhoo.h"
static void hyhoo_gfxdraw(running_machine &machine);
WRITE8_MEMBER(hyhoo_state::hyhoo_blitter_w)
{
switch (offset)
@ -27,7 +24,7 @@ WRITE8_MEMBER(hyhoo_state::hyhoo_blitter_w)
case 0x04: m_blitter_sizex = data; break;
case 0x05: m_blitter_sizey = data;
/* writing here also starts the blit */
hyhoo_gfxdraw(machine());
hyhoo_gfxdraw();
break;
case 0x06: m_blitter_direction_x = (data >> 0) & 0x01;
m_blitter_direction_y = (data >> 1) & 0x01;
@ -61,10 +58,9 @@ TIMER_CALLBACK_MEMBER(hyhoo_state::blitter_timer_callback)
nb1413m3_busyflag = 1;
}
static void hyhoo_gfxdraw(running_machine &machine)
void hyhoo_state::hyhoo_gfxdraw()
{
hyhoo_state *state = machine.driver_data<hyhoo_state>();
UINT8 *GFX = state->memregion("gfx1")->base();
UINT8 *GFX = memregion("gfx1")->base();
int x, y;
int dx1, dx2, dy;
@ -79,35 +75,35 @@ static void hyhoo_gfxdraw(running_machine &machine)
nb1413m3_busyctr = 0;
state->m_gfxrom |= ((nb1413m3_sndrombank1 & 0x02) << 3);
m_gfxrom |= ((nb1413m3_sndrombank1 & 0x02) << 3);
startx = state->m_blitter_destx + state->m_blitter_sizex;
starty = state->m_blitter_desty + state->m_blitter_sizey;
startx = m_blitter_destx + m_blitter_sizex;
starty = m_blitter_desty + m_blitter_sizey;
if (state->m_blitter_direction_x)
if (m_blitter_direction_x)
{
sizex = state->m_blitter_sizex ^ 0xff;
sizex = m_blitter_sizex ^ 0xff;
skipx = 1;
}
else
{
sizex = state->m_blitter_sizex;
sizex = m_blitter_sizex;
skipx = -1;
}
if (state->m_blitter_direction_y)
if (m_blitter_direction_y)
{
sizey = state->m_blitter_sizey ^ 0xff;
sizey = m_blitter_sizey ^ 0xff;
skipy = 1;
}
else
{
sizey = state->m_blitter_sizey;
sizey = m_blitter_sizey;
skipy = -1;
}
gfxlen = machine.root_device().memregion("gfx1")->bytes();
gfxaddr = (state->m_gfxrom << 17) + (state->m_blitter_src_addr << 1);
gfxlen = machine().root_device().memregion("gfx1")->bytes();
gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1);
for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
{
@ -127,13 +123,13 @@ static void hyhoo_gfxdraw(running_machine &machine)
dx2 = (2 * x + 1) & 0x1ff;
dy = y & 0xff;
if (state->m_highcolorflag & 0x04)
if (m_highcolorflag & 0x04)
{
// direct mode
if (color != 0xff)
{
if (state->m_highcolorflag & 0x20)
if (m_highcolorflag & 0x20)
{
/* least significant bits */
@ -146,8 +142,8 @@ static void hyhoo_gfxdraw(running_machine &machine)
pen = MAKE_RGB(pal6bit(r), pal5bit(g), pal5bit(b));
state->m_tmpbitmap.pix32(dy, dx1) = state->m_tmpbitmap.pix32(dy, dx1) | pen;
state->m_tmpbitmap.pix32(dy, dx2) = state->m_tmpbitmap.pix32(dy, dx2) | pen;
m_tmpbitmap.pix32(dy, dx1) = m_tmpbitmap.pix32(dy, dx1) | pen;
m_tmpbitmap.pix32(dy, dx2) = m_tmpbitmap.pix32(dy, dx2) | pen;
}
else
{
@ -162,8 +158,8 @@ static void hyhoo_gfxdraw(running_machine &machine)
pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
state->m_tmpbitmap.pix32(dy, dx1) = pen;
state->m_tmpbitmap.pix32(dy, dx2) = pen;
m_tmpbitmap.pix32(dy, dx1) = pen;
m_tmpbitmap.pix32(dy, dx2) = pen;
}
}
}
@ -171,7 +167,7 @@ static void hyhoo_gfxdraw(running_machine &machine)
{
// lookup table mode
if (state->m_blitter_direction_x)
if (m_blitter_direction_x)
{
// flip
color1 = (color & 0x0f) >> 0;
@ -184,32 +180,32 @@ static void hyhoo_gfxdraw(running_machine &machine)
color2 = (color & 0x0f) >> 0;
}
if (state->m_clut[color1])
if (m_clut[color1])
{
// src xxxxxxxx_bbgggrrr
// dst bbxxxggg_xxrrrxxx
r = ((~state->m_clut[color1] & 0x07) >> 0) & 0x07;
g = ((~state->m_clut[color1] & 0x38) >> 3) & 0x07;
b = ((~state->m_clut[color1] & 0xc0) >> 6) & 0x03;
r = ((~m_clut[color1] & 0x07) >> 0) & 0x07;
g = ((~m_clut[color1] & 0x38) >> 3) & 0x07;
b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03;
pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
state->m_tmpbitmap.pix32(dy, dx1) = pen;
m_tmpbitmap.pix32(dy, dx1) = pen;
}
if (state->m_clut[color2])
if (m_clut[color2])
{
// src xxxxxxxx_bbgggrrr
// dst bbxxxggg_xxrrrxxx
r = ((~state->m_clut[color2] & 0x07) >> 0) & 0x07;
g = ((~state->m_clut[color2] & 0x38) >> 3) & 0x07;
b = ((~state->m_clut[color2] & 0xc0) >> 6) & 0x03;
r = ((~m_clut[color2] & 0x07) >> 0) & 0x07;
g = ((~m_clut[color2] & 0x38) >> 3) & 0x07;
b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03;
pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
state->m_tmpbitmap.pix32(dy, dx2) = pen;
m_tmpbitmap.pix32(dy, dx2) = pen;
}
}
@ -218,7 +214,7 @@ static void hyhoo_gfxdraw(running_machine &machine)
}
nb1413m3_busyflag = 0;
machine.scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(hyhoo_state::blitter_timer_callback),state));
machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(hyhoo_state::blitter_timer_callback),this));
}

View File

@ -126,13 +126,12 @@ void hyperspt_state::video_start()
m_bg_tilemap->set_scroll_rows(32);
}
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void hyperspt_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
hyperspt_state *state = machine.driver_data<hyperspt_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram = m_spriteram;
int offs;
for (offs = state->m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
for (offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
{
int sx = spriteram[offs + 3];
int sy = 240 - spriteram[offs + 1];
@ -141,32 +140,32 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int flipx = ~spriteram[offs] & 0x40;
int flipy = spriteram[offs] & 0x80;
if (state->flip_screen())
if (flip_screen())
{
sy = 240 - sy;
flipy = !flipy;
}
/* Note that this adjustment must be done AFTER handling state->flip_screen(), thus */
/* Note that this adjustment must be done AFTER handling flip_screen(), thus */
/* proving that this is a hardware related "feature" */
sy += 1;
drawgfx_transmask(bitmap,cliprect,
machine.gfx[0],
machine().gfx[0],
code, color,
flipx, flipy,
sx, sy,
colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
/* redraw with wraparound */
drawgfx_transmask(bitmap,cliprect,
machine.gfx[0],
machine().gfx[0],
code, color,
flipx, flipy,
sx - 256, sy,
colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
}
}
@ -182,7 +181,7 @@ UINT32 hyperspt_state::screen_update_hyperspt(screen_device &screen, bitmap_ind1
}
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -103,28 +103,27 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_paletteram_w)
/* 8x8x4 tiles only */
INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int layer, UINT16 *vram)
inline void hyprduel_state::get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram)
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
UINT16 code;
int table_index;
UINT32 tile;
/* The actual tile index depends on the window */
tile_index = ((tile_index / WIN_NX + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
((tile_index % WIN_NX + state->m_window[layer * 2 + 1] / 8) % BIG_NX);
tile_index = ((tile_index / WIN_NX + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
((tile_index % WIN_NX + m_window[layer * 2 + 1] / 8) % BIG_NX);
/* Fetch the code */
code = vram[tile_index];
/* Use it as an index into the tiles set table */
table_index = ((code & 0x1ff0) >> 4 ) * 2;
tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1];
tile = (m_tiletable[table_index + 0] << 16) + m_tiletable[table_index + 1];
if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
{
int _code = code & 0x000f;
tileinfo.pen_data = state->m_empty_tiles + _code * 16 * 16;
tileinfo.pen_data = m_empty_tiles + _code * 16 * 16;
tileinfo.palette_base = ((code & 0x0ff0)) + 0x1000;
tileinfo.flags = 0;
tileinfo.group = 0;
@ -132,7 +131,7 @@ INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int ti
else
{
tileinfo.group = 0;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
0,
(tile & 0xfffff) + (code & 0xf),
(((tile & 0x0ff00000) >> 20)) + 0x100,
@ -142,28 +141,27 @@ INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int ti
/* 8x8x4 or 8x8x8 tiles. It's the tile's color that decides: if its low 4
bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
INLINE void get_tile_info_8bit( running_machine &machine, tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
inline void hyprduel_state::get_tile_info_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
UINT16 code;
int table_index;
UINT32 tile;
/* The actual tile index depends on the window */
tile_index = ((tile_index / WIN_NX + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
((tile_index % WIN_NX + state->m_window[layer * 2 + 1] / 8) % BIG_NX);
tile_index = ((tile_index / WIN_NX + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
((tile_index % WIN_NX + m_window[layer * 2 + 1] / 8) % BIG_NX);
/* Fetch the code */
code = vram[tile_index];
/* Use it as an index into the tiles set table */
table_index = ((code & 0x1ff0) >> 4) * 2;
tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1];
tile = (m_tiletable[table_index + 0] << 16) + m_tiletable[table_index + 1];
if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
{
int _code = code & 0x000f;
tileinfo.pen_data = state->m_empty_tiles + _code * 16 * 16;
tileinfo.pen_data = m_empty_tiles + _code * 16 * 16;
tileinfo.palette_base = ((code & 0x0ff0)) + 0x1000;
tileinfo.flags = 0;
tileinfo.group = 0;
@ -171,7 +169,7 @@ INLINE void get_tile_info_8bit( running_machine &machine, tile_data &tileinfo, i
else if ((tile & 0x00f00000) == 0x00f00000) /* draw tile as 8bpp */
{
tileinfo.group = 1;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
1,
(tile & 0xfffff) + 2*(code & 0xf),
((tile & 0x0f000000) >> 24) + 0x10,
@ -180,7 +178,7 @@ INLINE void get_tile_info_8bit( running_machine &machine, tile_data &tileinfo, i
else
{
tileinfo.group = 0;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
0,
(tile & 0xfffff) + (code & 0xf),
(((tile & 0x0ff00000) >> 20)) + 0x100,
@ -190,28 +188,27 @@ INLINE void get_tile_info_8bit( running_machine &machine, tile_data &tileinfo, i
/* 16x16x4 or 16x16x8 tiles. It's the tile's color that decides: if its low 4
bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
INLINE void get_tile_info_16x16_8bit( running_machine &machine, tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
inline void hyprduel_state::get_tile_info_16x16_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
UINT16 code;
int table_index;
UINT32 tile;
/* The actual tile index depends on the window */
tile_index = ((tile_index / WIN_NX + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
((tile_index % WIN_NX + state->m_window[layer * 2 + 1] / 8) % BIG_NX);
tile_index = ((tile_index / WIN_NX + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
((tile_index % WIN_NX + m_window[layer * 2 + 1] / 8) % BIG_NX);
/* Fetch the code */
code = vram[tile_index];
/* Use it as an index into the tiles set table */
table_index = ((code & 0x1ff0) >> 4) * 2;
tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1];
tile = (m_tiletable[table_index + 0] << 16) + m_tiletable[table_index + 1];
if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
{
int _code = code & 0x000f;
tileinfo.pen_data = state->m_empty_tiles + _code * 16 * 16;
tileinfo.pen_data = m_empty_tiles + _code * 16 * 16;
tileinfo.palette_base = ((code & 0x0ff0)) + 0x1000;
tileinfo.flags = 0;
tileinfo.group = 0;
@ -219,7 +216,7 @@ INLINE void get_tile_info_16x16_8bit( running_machine &machine, tile_data &tilei
else if ((tile & 0x00f00000) == 0x00f00000) /* draw tile as 8bpp */
{
tileinfo.group = 1;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
3,
(tile & 0xfffff) + 8*(code & 0xf),
((tile & 0x0f000000) >> 24) + 0x10,
@ -228,7 +225,7 @@ INLINE void get_tile_info_16x16_8bit( running_machine &machine, tile_data &tilei
else
{
tileinfo.group = 0;
SET_TILE_INFO(
SET_TILE_INFO_MEMBER(
2,
(tile & 0xfffff) + 4*(code & 0xf),
(((tile & 0x0ff00000) >> 20)) + 0x100,
@ -237,20 +234,19 @@ INLINE void get_tile_info_16x16_8bit( running_machine &machine, tile_data &tilei
}
}
INLINE void hyprduel_vram_w( running_machine &machine, offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram )
inline void hyprduel_state::hyprduel_vram_w( offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
COMBINE_DATA(&vram[offset]);
{
/* Account for the window */
int col = (offset % BIG_NX) - ((state->m_window[layer * 2 + 1] / 8) % BIG_NX);
int row = (offset / BIG_NX) - ((state->m_window[layer * 2 + 0] / 8) % BIG_NY);
int col = (offset % BIG_NX) - ((m_window[layer * 2 + 1] / 8) % BIG_NX);
int row = (offset / BIG_NX) - ((m_window[layer * 2 + 0] / 8) % BIG_NY);
if (col < -(BIG_NX-WIN_NX))
col += (BIG_NX-WIN_NX) + WIN_NX;
if (row < -(BIG_NY-WIN_NY))
row += (BIG_NY-WIN_NY) + WIN_NY;
if ((col >= 0) && (col < WIN_NX) && (row >= 0) && (row < WIN_NY))
state->m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
}
}
@ -258,32 +254,32 @@ INLINE void hyprduel_vram_w( running_machine &machine, offs_t offset, UINT16 dat
TILE_GET_INFO_MEMBER(hyprduel_state::get_tile_info_0_8bit)
{
get_tile_info_8bit(machine(), tileinfo, tile_index, 0, m_vram_0);
get_tile_info_8bit(tileinfo, tile_index, 0, m_vram_0);
}
TILE_GET_INFO_MEMBER(hyprduel_state::get_tile_info_1_8bit)
{
get_tile_info_8bit(machine(), tileinfo, tile_index, 1, m_vram_1);
get_tile_info_8bit(tileinfo, tile_index, 1, m_vram_1);
}
TILE_GET_INFO_MEMBER(hyprduel_state::get_tile_info_2_8bit)
{
get_tile_info_8bit(machine(), tileinfo, tile_index, 2, m_vram_2);
get_tile_info_8bit(tileinfo, tile_index, 2, m_vram_2);
}
WRITE16_MEMBER(hyprduel_state::hyprduel_vram_0_w)
{
hyprduel_vram_w(machine(), offset, data, mem_mask, 0, m_vram_0);
hyprduel_vram_w(offset, data, mem_mask, 0, m_vram_0);
}
WRITE16_MEMBER(hyprduel_state::hyprduel_vram_1_w)
{
hyprduel_vram_w(machine(), offset, data, mem_mask, 1, m_vram_1);
hyprduel_vram_w(offset, data, mem_mask, 1, m_vram_1);
}
WRITE16_MEMBER(hyprduel_state::hyprduel_vram_2_w)
{
hyprduel_vram_w(machine(), offset, data, mem_mask, 2, m_vram_2);
hyprduel_vram_w(offset, data, mem_mask, 2, m_vram_2);
}
@ -311,17 +307,16 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_window_w)
the tile's sizes to be known at startup - which we don't!
*/
static void alloc_empty_tiles( running_machine &machine )
void hyprduel_state::alloc_empty_tiles( )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
int code,i;
state->m_empty_tiles = auto_alloc_array(machine, UINT8, 16*16*16);
state->save_pointer(NAME(state->m_empty_tiles), 16*16*16);
m_empty_tiles = auto_alloc_array(machine(), UINT8, 16*16*16);
save_pointer(NAME(m_empty_tiles), 16*16*16);
for (code = 0; code < 0x10; code++)
for (i = 0; i < 16 * 16; i++)
state->m_empty_tiles[16 * 16 * code + i] = code;
m_empty_tiles[16 * 16 * code + i] = code;
}
@ -342,7 +337,7 @@ void hyprduel_state::hyprduel_postload()
}
static void expand_gfx1(hyprduel_state &state)
void hyprduel_state::expand_gfx1(hyprduel_state &state)
{
UINT8 *base_gfx = state.machine().root_device().memregion("gfx1")->base();
UINT32 length = 2 * state.machine().root_device().memregion("gfx1")->bytes();
@ -358,7 +353,7 @@ static void expand_gfx1(hyprduel_state &state)
VIDEO_START_MEMBER(hyprduel_state,common_14220)
{
expand_gfx1(*this);
alloc_empty_tiles(machine());
alloc_empty_tiles();
m_tiletable_old = auto_alloc_array(machine(), UINT16, m_tiletable.bytes() / 2);
m_dirtyindex = auto_alloc_array(machine(), UINT8, m_tiletable.bytes() / 4);
@ -459,20 +454,19 @@ VIDEO_START_MEMBER(hyprduel_state,magerror_14220)
/* Draw sprites */
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void hyprduel_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
UINT8 *base_gfx4 = state->m_expanded_gfx1;
UINT8 *base_gfx8 = state->memregion("gfx1")->base();
UINT32 gfx_size = state->memregion("gfx1")->bytes();
UINT8 *base_gfx4 = m_expanded_gfx1;
UINT8 *base_gfx8 = memregion("gfx1")->base();
UINT32 gfx_size = memregion("gfx1")->bytes();
int max_x = machine.primary_screen->width();
int max_y = machine.primary_screen->height();
int max_x = machine().primary_screen->width();
int max_y = machine().primary_screen->height();
int max_sprites = state->m_spriteram.bytes() / 8;
int sprites = state->m_videoregs[0x00 / 2] % max_sprites;
int max_sprites = m_spriteram.bytes() / 8;
int sprites = m_videoregs[0x00 / 2] % max_sprites;
int color_start = ((state->m_videoregs[0x08 / 2] & 0xf) << 4) + 0x100;
int color_start = ((m_videoregs[0x08 / 2] & 0xf) << 4) + 0x100;
int i, j, pri;
static const int primask[4] = { 0x0000, 0xff00, 0xff00|0xf0f0, 0xff00|0xf0f0|0xcccc };
@ -485,12 +479,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
for (i = 0; i < 0x20; i++)
{
if (!(state->m_videoregs[0x02 / 2] & 0x8000))
if (!(m_videoregs[0x02 / 2] & 0x8000))
{
src = state->m_spriteram + (sprites - 1) * (8 / 2);
src = m_spriteram + (sprites - 1) * (8 / 2);
inc = -(8 / 2);
} else {
src = state->m_spriteram;
src = m_spriteram;
inc = (8 / 2);
}
@ -520,12 +514,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
continue;
}
pri = (state->m_videoregs[0x02 / 2] & 0x0300) >> 8;
pri = (m_videoregs[0x02 / 2] & 0x0300) >> 8;
if (!(state->m_videoregs[0x02 / 2] & 0x8000))
if (!(m_videoregs[0x02 / 2] & 0x8000))
{
if (curr_pri > (state->m_videoregs[0x02 / 2] & 0x1f))
pri = (state->m_videoregs[0x02 / 2] & 0x0c00) >> 10;
if (curr_pri > (m_videoregs[0x02 / 2] & 0x1f))
pri = (m_videoregs[0x02 / 2] & 0x0c00) >> 10;
}
y = src[1];
@ -538,15 +532,15 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
zoom = zoomtable[(y & 0xfc00) >> 10] << (16 - 8);
x = (x & 0x07ff) - state->m_sprite_xoffs;
y = (y & 0x03ff) - state->m_sprite_yoffs;
x = (x & 0x07ff) - m_sprite_xoffs;
y = (y & 0x03ff) - m_sprite_yoffs;
width = (((attr >> 11) & 0x7) + 1) * 8;
height = (((attr >> 8) & 0x7) + 1) * 8;
UINT32 gfxstart = (8 * 8 * 4 / 8) * (((attr & 0x000f) << 16) + code);
if (state->flip_screen())
if (flip_screen())
{
flipx = !flipx; x = max_x - x - width;
flipy = !flipy; y = max_y - y - height;
@ -558,7 +552,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if ((gfxstart + width * height - 1) >= gfx_size)
continue;
gfx_element gfx(machine, base_gfx8 + gfxstart, width, height, width, 0, 256);
gfx_element gfx(machine(), base_gfx8 + gfxstart, width, height, width, 0, 256);
pdrawgfxzoom_transpen(bitmap,cliprect, &gfx,
0,
@ -566,7 +560,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
flipx, flipy,
x, y,
zoom, zoom,
machine.priority_bitmap,primask[pri], 255);
machine().priority_bitmap,primask[pri], 255);
}
else
{
@ -574,7 +568,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if ((gfxstart + width / 2 * height - 1) >= gfx_size)
continue;
gfx_element gfx(machine, base_gfx4 + 2 * gfxstart, width, height, width, 0, 16);
gfx_element gfx(machine(), base_gfx4 + 2 * gfxstart, width, height, width, 0, 16);
pdrawgfxzoom_transpen(bitmap,cliprect, &gfx,
0,
@ -582,7 +576,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
flipx, flipy,
x, y,
zoom, zoom,
machine.priority_bitmap,primask[pri], 15);
machine().priority_bitmap,primask[pri], 15);
}
#if 0
{ /* Display priority + zoom on each sprite */
@ -630,10 +624,9 @@ WRITE16_MEMBER(hyprduel_state::hyprduel_scrollreg_init_w)
}
static void draw_layers( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl )
void hyprduel_state::draw_layers( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
UINT16 layers_pri = state->m_videoregs[0x10/2];
UINT16 layers_pri = m_videoregs[0x10/2];
int layer;
/* Draw all the layers with priority == pri */
@ -642,26 +635,25 @@ static void draw_layers( running_machine &machine, bitmap_ind16 &bitmap, const r
if ( pri == ((layers_pri >> (layer*2)) & 3) )
{
if (layers_ctrl & (1 << layer)) // for debug
state->m_bg_tilemap[layer]->draw(bitmap, cliprect, 0, 1 << (3 - pri));
m_bg_tilemap[layer]->draw(bitmap, cliprect, 0, 1 << (3 - pri));
}
}
}
/* Dirty tilemaps when the tiles set changes */
static void dirty_tiles( running_machine &machine, int layer, UINT16 *vram )
void hyprduel_state::dirty_tiles( int layer, UINT16 *vram )
{
hyprduel_state *state = machine.driver_data<hyprduel_state>();
int col, row;
for (row = 0; row < WIN_NY; row++)
{
for (col = 0; col < WIN_NX; col++)
{
int offset = (col + state->m_window[layer * 2 + 1] / 8) % BIG_NX + ((row + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX;
int offset = (col + m_window[layer * 2 + 1] / 8) % BIG_NX + ((row + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX;
UINT16 code = vram[offset];
if (!(code & 0x8000) && state->m_dirtyindex[(code & 0x1ff0) >> 4])
state->m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
if (!(code & 0x8000) && m_dirtyindex[(code & 0x1ff0) >> 4])
m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
}
}
}
@ -691,9 +683,9 @@ UINT32 hyprduel_state::screen_update_hyprduel(screen_device &screen, bitmap_ind1
if (dirty)
{
dirty_tiles(machine(), 0, m_vram_0);
dirty_tiles(machine(), 1, m_vram_1);
dirty_tiles(machine(), 2, m_vram_2);
dirty_tiles(0, m_vram_0);
dirty_tiles(1, m_vram_1);
dirty_tiles(2, m_vram_2);
}
}
@ -740,10 +732,10 @@ if (machine().input().code_pressed(KEYCODE_Z))
#endif
for (pri = 3; pri >= 0; pri--)
draw_layers(machine(), bitmap, cliprect, pri, layers_ctrl);
draw_layers(bitmap, cliprect, pri, layers_ctrl);
if (layers_ctrl & 0x08)
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}