Modernization of drivers part 6 (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2013-02-08 11:39:01 +00:00
parent 18dcd633bc
commit 0af8c1b855
84 changed files with 1287 additions and 1365 deletions

View File

@ -1506,12 +1506,12 @@ DRIVER_INIT_MEMBER(gaiden_state,raiga)
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this));
} }
static void descramble_drgnbowl_gfx(running_machine &machine) void gaiden_state::descramble_drgnbowl_gfx()
{ {
int i; int i;
UINT8 *ROM = machine.root_device().memregion("maincpu")->base(); UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
size_t size = machine.root_device().memregion("maincpu")->bytes(); size_t size = machine().root_device().memregion("maincpu")->bytes();
UINT8 *buffer = auto_alloc_array(machine, UINT8, size); UINT8 *buffer = auto_alloc_array(machine(), UINT8, size);
memcpy(buffer, ROM, size); memcpy(buffer, ROM, size);
for( i = 0; i < size; i++ ) for( i = 0; i < size; i++ )
@ -1524,11 +1524,11 @@ static void descramble_drgnbowl_gfx(running_machine &machine)
3, 2, 1, 0)]; 3, 2, 1, 0)];
} }
auto_free(machine, buffer); auto_free(machine(), buffer);
ROM = machine.root_device().memregion("gfx2")->base(); ROM = machine().root_device().memregion("gfx2")->base();
size = machine.root_device().memregion("gfx2")->bytes(); size = machine().root_device().memregion("gfx2")->bytes();
buffer = auto_alloc_array(machine, UINT8, size); buffer = auto_alloc_array(machine(), UINT8, size);
memcpy(buffer,ROM,size); memcpy(buffer,ROM,size);
for( i = 0; i < size; i++ ) for( i = 0; i < size; i++ )
@ -1541,23 +1541,23 @@ static void descramble_drgnbowl_gfx(running_machine &machine)
5, 2, 1, 0)]; 5, 2, 1, 0)];
} }
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
DRIVER_INIT_MEMBER(gaiden_state,drgnbowl) DRIVER_INIT_MEMBER(gaiden_state,drgnbowl)
{ {
m_raiga_jumppoints = jumppoints_00; m_raiga_jumppoints = jumppoints_00;
descramble_drgnbowl_gfx(machine()); descramble_drgnbowl_gfx();
} }
static void descramble_mastninj_gfx(running_machine &machine, UINT8* src) void gaiden_state::descramble_mastninj_gfx(UINT8* src)
{ {
UINT8 *buffer; UINT8 *buffer;
int len = 0x80000; int len = 0x80000;
/* rearrange gfx */ /* rearrange gfx */
buffer = auto_alloc_array(machine, UINT8, len); buffer = auto_alloc_array(machine(), UINT8, len);
{ {
int i; int i;
for (i = 0;i < len; i++) for (i = 0;i < len; i++)
@ -1571,10 +1571,10 @@ static void descramble_mastninj_gfx(running_machine &machine, UINT8* src)
3,2,1,0)]; 3,2,1,0)];
} }
memcpy(src, buffer, len); memcpy(src, buffer, len);
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
buffer = auto_alloc_array(machine, UINT8, len); buffer = auto_alloc_array(machine(), UINT8, len);
{ {
int i; int i;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
@ -1588,15 +1588,15 @@ static void descramble_mastninj_gfx(running_machine &machine, UINT8* src)
3,2,1,0)]; 3,2,1,0)];
} }
memcpy(src, buffer, len); memcpy(src, buffer, len);
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
} }
DRIVER_INIT_MEMBER(gaiden_state,mastninj) DRIVER_INIT_MEMBER(gaiden_state,mastninj)
{ {
// rearrange the graphic roms into a format that MAME can decode // rearrange the graphic roms into a format that MAME can decode
descramble_mastninj_gfx(machine(), machine().root_device().memregion("gfx2")->base()); descramble_mastninj_gfx(machine().root_device().memregion("gfx2")->base());
descramble_mastninj_gfx(machine(), machine().root_device().memregion("gfx3")->base()); descramble_mastninj_gfx(machine().root_device().memregion("gfx3")->base());
DRIVER_INIT_CALL(shadoww); DRIVER_INIT_CALL(shadoww);
} }

View File

@ -882,21 +882,20 @@ MACHINE_START_MEMBER(galaga_state,galaga)
save_item(NAME(m_sub2_nmi_mask)); save_item(NAME(m_sub2_nmi_mask));
} }
static void bosco_latch_reset(running_machine &machine) void galaga_state::bosco_latch_reset()
{ {
galaga_state *state = machine.driver_data<galaga_state>(); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
int i; int i;
/* Reset all latches */ /* Reset all latches */
for (i = 0;i < 8;i++) for (i = 0;i < 8;i++)
state->bosco_latch_w(space,i,0); bosco_latch_w(space,i,0);
} }
MACHINE_RESET_MEMBER(galaga_state,galaga) MACHINE_RESET_MEMBER(galaga_state,galaga)
{ {
/* Reset all latches */ /* Reset all latches */
bosco_latch_reset(machine()); bosco_latch_reset();
m_cpu3_interrupt_timer->adjust(machine().primary_screen->time_until_pos(64), 64); m_cpu3_interrupt_timer->adjust(machine().primary_screen->time_until_pos(64), 64);
} }

View File

@ -827,15 +827,14 @@ READ8_MEMBER(galaxian_state::monsterz_protection_r)
} }
static void monsterz_set_latch(running_machine &machine) void galaxian_state::monsterz_set_latch()
{ {
// read from a rom (which one?? "a-3e.k3" from audiocpu ($2700-$2fff) looks very suspicious) // read from a rom (which one?? "a-3e.k3" from audiocpu ($2700-$2fff) looks very suspicious)
galaxian_state *state = machine.driver_data<galaxian_state>(); UINT8 *rom = memregion("audiocpu")->base();
UINT8 *rom = state->memregion("audiocpu")->base(); m_protection_result = rom[0x2000 | (m_protection_state & 0x1fff)]; // probably needs a BITSWAP8
state->m_protection_result = rom[0x2000 | (state->m_protection_state & 0x1fff)]; // probably needs a BITSWAP8
// and an irq on the main z80 afterwards // and an irq on the main z80 afterwards
machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE ); machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE );
} }
@ -844,7 +843,7 @@ WRITE8_MEMBER(galaxian_state::monsterz_porta_1_w)
// d7 high: set latch + advance address high bits (and reset low bits?) // d7 high: set latch + advance address high bits (and reset low bits?)
if (data & 0x80) if (data & 0x80)
{ {
monsterz_set_latch(machine()); monsterz_set_latch();
m_protection_state = (m_protection_state + 0x100) & 0xff00; m_protection_state = (m_protection_state + 0x100) & 0xff00;
} }
} }
@ -854,7 +853,7 @@ WRITE8_MEMBER(galaxian_state::monsterz_portb_1_w)
// d3 high: set latch + advance address low bits // d3 high: set latch + advance address low bits
if (data & 0x08) if (data & 0x08)
{ {
monsterz_set_latch(machine()); monsterz_set_latch();
m_protection_state = ((m_protection_state + 1) & 0x00ff) | (m_protection_state & 0xff00); m_protection_state = ((m_protection_state + 1) & 0x00ff) | (m_protection_state & 0xff00);
} }
} }
@ -2514,9 +2513,9 @@ MACHINE_CONFIG_END
* *
*************************************/ *************************************/
static void decode_mooncrst(running_machine &machine, int length, UINT8 *dest) void galaxian_state::decode_mooncrst(int length, UINT8 *dest)
{ {
UINT8 *rom = machine.root_device().memregion("maincpu")->base(); UINT8 *rom = machine().root_device().memregion("maincpu")->base();
int offs; int offs;
for (offs = 0; offs < length; offs++) for (offs = 0; offs < length; offs++)
@ -2531,7 +2530,7 @@ static void decode_mooncrst(running_machine &machine, int length, UINT8 *dest)
} }
static void decode_checkman(running_machine &machine) void galaxian_state::decode_checkman()
{ {
/* /*
Encryption Table Encryption Table
@ -2578,8 +2577,8 @@ static void decode_checkman(running_machine &machine)
{ 0,2,0,2 }, { 0,2,0,2 },
{ 1,4,1,4 } { 1,4,1,4 }
}; };
UINT8 *rombase = machine.root_device().memregion("maincpu")->base(); UINT8 *rombase = machine().root_device().memregion("maincpu")->base();
UINT32 romlength = machine.root_device().memregion("maincpu")->bytes(); UINT32 romlength = machine().root_device().memregion("maincpu")->bytes();
UINT32 offs; UINT32 offs;
for (offs = 0; offs < romlength; offs++) for (offs = 0; offs < romlength; offs++)
@ -2593,10 +2592,10 @@ static void decode_checkman(running_machine &machine)
} }
static void decode_dingoe(running_machine &machine) void galaxian_state::decode_dingoe()
{ {
UINT8 *rombase = machine.root_device().memregion("maincpu")->base(); UINT8 *rombase = machine().root_device().memregion("maincpu")->base();
UINT32 romlength = machine.root_device().memregion("maincpu")->bytes(); UINT32 romlength = machine().root_device().memregion("maincpu")->bytes();
UINT32 offs; UINT32 offs;
for (offs = 0; offs < romlength; offs++) for (offs = 0; offs < romlength; offs++)
@ -2616,9 +2615,9 @@ static void decode_dingoe(running_machine &machine)
} }
static void decode_frogger_sound(running_machine &machine) void galaxian_state::decode_frogger_sound()
{ {
UINT8 *rombase = machine.root_device().memregion("audiocpu")->base(); UINT8 *rombase = machine().root_device().memregion("audiocpu")->base();
UINT32 offs; UINT32 offs;
/* the first ROM of the sound CPU has data lines D0 and D1 swapped */ /* the first ROM of the sound CPU has data lines D0 and D1 swapped */
@ -2627,9 +2626,9 @@ static void decode_frogger_sound(running_machine &machine)
} }
static void decode_frogger_gfx(running_machine &machine) void galaxian_state::decode_frogger_gfx()
{ {
UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
UINT32 offs; UINT32 offs;
/* the 2nd gfx ROM has data lines D0 and D1 swapped */ /* the 2nd gfx ROM has data lines D0 and D1 swapped */
@ -2638,11 +2637,11 @@ static void decode_frogger_gfx(running_machine &machine)
} }
static void decode_anteater_gfx(running_machine &machine) void galaxian_state::decode_anteater_gfx()
{ {
UINT32 romlength = machine.root_device().memregion("gfx1")->bytes(); UINT32 romlength = machine().root_device().memregion("gfx1")->bytes();
UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength); UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength);
UINT32 offs; UINT32 offs;
memcpy(scratch, rombase, romlength); memcpy(scratch, rombase, romlength);
@ -2654,15 +2653,15 @@ static void decode_anteater_gfx(running_machine &machine)
srcoffs |= (BIT(offs,0) ^ BIT(offs,6) ^ 1) << 10; srcoffs |= (BIT(offs,0) ^ BIT(offs,6) ^ 1) << 10;
rombase[offs] = scratch[srcoffs]; rombase[offs] = scratch[srcoffs];
} }
auto_free(machine, scratch); auto_free(machine(), scratch);
} }
static void decode_losttomb_gfx(running_machine &machine) void galaxian_state::decode_losttomb_gfx()
{ {
UINT32 romlength = machine.root_device().memregion("gfx1")->bytes(); UINT32 romlength = machine().root_device().memregion("gfx1")->bytes();
UINT8 *rombase = machine.root_device().memregion("gfx1")->base(); UINT8 *rombase = machine().root_device().memregion("gfx1")->base();
UINT8 *scratch = auto_alloc_array(machine, UINT8, romlength); UINT8 *scratch = auto_alloc_array(machine(), UINT8, romlength);
UINT32 offs; UINT32 offs;
memcpy(scratch, rombase, romlength); memcpy(scratch, rombase, romlength);
@ -2674,18 +2673,18 @@ static void decode_losttomb_gfx(running_machine &machine)
srcoffs |= ((BIT(offs,1) & BIT(offs,7)) | ((1 ^ BIT(offs,1)) & (BIT(offs,8)))) << 10; srcoffs |= ((BIT(offs,1) & BIT(offs,7)) | ((1 ^ BIT(offs,1)) & (BIT(offs,8)))) << 10;
rombase[offs] = scratch[srcoffs]; rombase[offs] = scratch[srcoffs];
} }
auto_free(machine, scratch); auto_free(machine(), scratch);
} }
static void decode_superbon(running_machine &machine) void galaxian_state::decode_superbon()
{ {
offs_t i; offs_t i;
UINT8 *RAM; UINT8 *RAM;
/* Deryption worked out by hand by Chris Hardy. */ /* Deryption worked out by hand by Chris Hardy. */
RAM = machine.root_device().memregion("maincpu")->base(); RAM = machine().root_device().memregion("maincpu")->base();
for (i = 0;i < 0x1000;i++) for (i = 0;i < 0x1000;i++)
{ {
@ -2715,30 +2714,25 @@ static void decode_superbon(running_machine &machine)
* *
*************************************/ *************************************/
static void common_init( void galaxian_state::common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background,
running_machine &machine, galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info)
galaxian_draw_bullet_func draw_bullet,
galaxian_draw_background_func draw_background,
galaxian_extend_tile_info_func extend_tile_info,
galaxian_extend_sprite_info_func extend_sprite_info)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); m_irq_enabled = 0;
state->m_irq_enabled = 0; m_irq_line = INPUT_LINE_NMI;
state->m_irq_line = INPUT_LINE_NMI; m_numspritegens = 1;
state->m_numspritegens = 1; m_bullets_base = 0x60;
state->m_bullets_base = 0x60; m_frogger_adjust = FALSE;
state->m_frogger_adjust = FALSE; m_sfx_tilemap = FALSE;
state->m_sfx_tilemap = FALSE; m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : &galaxian_state::galaxian_draw_bullet;
state->m_draw_bullet_ptr = (draw_bullet != NULL) ? draw_bullet : galaxian_draw_bullet; m_draw_background_ptr = (draw_background != NULL) ? draw_background : &galaxian_state::galaxian_draw_background;
state->m_draw_background_ptr = (draw_background != NULL) ? draw_background : galaxian_draw_background; m_extend_tile_info_ptr = extend_tile_info;
state->m_extend_tile_info_ptr = extend_tile_info; m_extend_sprite_info_ptr = extend_sprite_info;
state->m_extend_sprite_info_ptr = extend_sprite_info;
} }
static void unmap_galaxian_sound(running_machine &machine, offs_t base) void galaxian_state::unmap_galaxian_sound(offs_t base)
{ {
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
space.unmap_write(base + 0x0004, base + 0x0007, 0, 0x07f8); space.unmap_write(base + 0x0004, base + 0x0007, 0, 0x07f8);
space.unmap_write(base + 0x0800, base + 0x0807, 0, 0x07f8); space.unmap_write(base + 0x0800, base + 0x0807, 0, 0x07f8);
@ -2755,7 +2749,7 @@ static void unmap_galaxian_sound(running_machine &machine, offs_t base)
DRIVER_INIT_MEMBER(galaxian_state,galaxian) DRIVER_INIT_MEMBER(galaxian_state,galaxian)
{ {
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
} }
@ -2776,7 +2770,7 @@ DRIVER_INIT_MEMBER(galaxian_state,azurian)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* yellow bullets instead of white ones */ /* yellow bullets instead of white ones */
common_init(machine(), scramble_draw_bullet, galaxian_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
/* coin lockout disabled */ /* coin lockout disabled */
space.unmap_write(0x6002, 0x6002, 0, 0x7f8); space.unmap_write(0x6002, 0x6002, 0, 0x7f8);
@ -2788,7 +2782,7 @@ DRIVER_INIT_MEMBER(galaxian_state,gmgalax)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::gmgalax_extend_tile_info, &galaxian_state::gmgalax_extend_sprite_info);
/* ROM is banked */ /* ROM is banked */
space.install_read_bank(0x0000, 0x3fff, "bank1"); space.install_read_bank(0x0000, 0x3fff, "bank1");
@ -2805,7 +2799,7 @@ DRIVER_INIT_MEMBER(galaxian_state,pisces)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info);
/* coin lockout replaced by graphics bank */ /* coin lockout replaced by graphics bank */
space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
@ -2817,7 +2811,7 @@ DRIVER_INIT_MEMBER(galaxian_state,batman2)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
/* coin lockout replaced by graphics bank */ /* coin lockout replaced by graphics bank */
space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
@ -2829,7 +2823,7 @@ DRIVER_INIT_MEMBER(galaxian_state,frogg)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* same as galaxian... */ /* same as galaxian... */
common_init(machine(), galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
/* ...but needs a full 2k of RAM */ /* ...but needs a full 2k of RAM */
space.install_ram(0x4000, 0x47ff); space.install_ram(0x4000, 0x47ff);
@ -2846,17 +2840,17 @@ DRIVER_INIT_MEMBER(galaxian_state,frogg)
DRIVER_INIT_MEMBER(galaxian_state,mooncrst) DRIVER_INIT_MEMBER(galaxian_state,mooncrst)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
/* decrypt program code */ /* decrypt program code */
decode_mooncrst(machine(), 0x8000, machine().root_device().memregion("maincpu")->base()); decode_mooncrst(0x8000, machine().root_device().memregion("maincpu")->base());
} }
DRIVER_INIT_MEMBER(galaxian_state,mooncrsu) DRIVER_INIT_MEMBER(galaxian_state,mooncrsu)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
} }
@ -2865,7 +2859,7 @@ DRIVER_INIT_MEMBER(galaxian_state,mooncrgx)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
/* LEDs and coin lockout replaced by graphics banking */ /* LEDs and coin lockout replaced by graphics banking */
space.install_write_handler(0x6000, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); space.install_write_handler(0x6000, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
@ -2878,10 +2872,10 @@ DRIVER_INIT_MEMBER(galaxian_state,moonqsr)
UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, moonqsr_extend_tile_info, moonqsr_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::moonqsr_extend_tile_info, &galaxian_state::moonqsr_extend_sprite_info);
/* decrypt program code */ /* decrypt program code */
decode_mooncrst(machine(), 0x8000, decrypt); decode_mooncrst(0x8000, decrypt);
space.set_decrypted_region(0x0000, 0x7fff, decrypt); space.set_decrypted_region(0x0000, 0x7fff, decrypt);
} }
@ -2957,7 +2951,7 @@ DRIVER_INIT_MEMBER(galaxian_state,tenspot)
which tenspot appears to have copied */ which tenspot appears to have copied */
/* video extensions */ /* video extensions */
//common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); //common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
/* coin lockout replaced by graphics bank */ /* coin lockout replaced by graphics bank */
//space.install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(galaxian_gfxbank_w)); //space.install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(galaxian_gfxbank_w));
@ -2979,7 +2973,7 @@ DRIVER_INIT_MEMBER(galaxian_state,tenspot)
DRIVER_INIT_MEMBER(galaxian_state,devilfsg) DRIVER_INIT_MEMBER(galaxian_state,devilfsg)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
/* IRQ line is INT, not NMI */ /* IRQ line is INT, not NMI */
m_irq_line = 0; m_irq_line = 0;
@ -2991,7 +2985,7 @@ DRIVER_INIT_MEMBER(galaxian_state,zigzag)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), NULL, galaxian_draw_background, NULL, NULL); common_init(NULL, &galaxian_state::galaxian_draw_background, NULL, NULL);
m_draw_bullet_ptr = NULL; m_draw_bullet_ptr = NULL;
/* two sprite generators */ /* two sprite generators */
@ -3016,7 +3010,7 @@ DRIVER_INIT_MEMBER(galaxian_state,zigzag)
space.unmap_write(0x6002, 0x6002, 0, 0x7f8); space.unmap_write(0x6002, 0x6002, 0, 0x7f8);
/* remove the galaxian sound hardware */ /* remove the galaxian sound hardware */
unmap_galaxian_sound(machine(), 0x6000); unmap_galaxian_sound( 0x6000);
/* install our AY-8910 handler */ /* install our AY-8910 handler */
space.install_write_handler(0x4800, 0x4fff, write8_delegate(FUNC(galaxian_state::zigzag_ay8910_w),this)); space.install_write_handler(0x4800, 0x4fff, write8_delegate(FUNC(galaxian_state::zigzag_ay8910_w),this));
@ -3026,7 +3020,7 @@ DRIVER_INIT_MEMBER(galaxian_state,zigzag)
DRIVER_INIT_MEMBER(galaxian_state,jumpbug) DRIVER_INIT_MEMBER(galaxian_state,jumpbug)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, jumpbug_draw_background, jumpbug_extend_tile_info, jumpbug_extend_sprite_info); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::jumpbug_draw_background, &galaxian_state::jumpbug_extend_tile_info, &galaxian_state::jumpbug_extend_sprite_info);
} }
@ -3036,7 +3030,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkman)
address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
/* move the interrupt enable from $b000 to $b001 */ /* move the interrupt enable from $b000 to $b001 */
space.unmap_write(0xb000, 0xb000, 0, 0x7f8); space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
@ -3046,7 +3040,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkman)
iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
/* decrypt program code */ /* decrypt program code */
decode_checkman(machine()); decode_checkman();
} }
@ -3055,7 +3049,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkmaj)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
/* attach the sound command handler */ /* attach the sound command handler */
space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
@ -3070,7 +3064,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingo)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
/* attach the sound command handler */ /* attach the sound command handler */
space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); space.install_write_handler(0x7800, 0x7800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this));
@ -3086,7 +3080,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingoe)
address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); address_space &iospace = machine().device("maincpu")->memory().space(AS_IO);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
/* move the interrupt enable from $b000 to $b001 */ /* move the interrupt enable from $b000 to $b001 */
space.unmap_write(0xb000, 0xb000, 0, 0x7f8); space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
@ -3098,7 +3092,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingoe)
space.install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),this)); /* Protection check */ space.install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),this)); /* Protection check */
/* decrypt program code */ /* decrypt program code */
decode_dingoe(machine()); decode_dingoe();
} }
@ -3107,7 +3101,7 @@ DRIVER_INIT_MEMBER(galaxian_state,skybase)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::pisces_extend_tile_info, &galaxian_state::pisces_extend_sprite_info);
/* coin lockout replaced by graphics bank */ /* coin lockout replaced by graphics bank */
space.install_write_handler(0xa002, 0xa002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this)); space.install_write_handler(0xa002, 0xa002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
@ -3125,7 +3119,7 @@ DRIVER_INIT_MEMBER(galaxian_state,kong)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info);
/* needs a full 2k of RAM */ /* needs a full 2k of RAM */
space.install_ram(0x8000, 0x87ff); space.install_ram(0x8000, 0x87ff);
@ -3135,11 +3129,11 @@ DRIVER_INIT_MEMBER(galaxian_state,kong)
} }
static void mshuttle_decode(running_machine &machine, const UINT8 convtable[8][16]) void galaxian_state::mshuttle_decode(const UINT8 convtable[8][16])
{ {
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
UINT8 *rom = machine.root_device().memregion("maincpu")->base(); UINT8 *rom = machine().root_device().memregion("maincpu")->base();
UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x10000);
int A; int A;
space.set_decrypted_region(0x0000, 0xffff, decrypt); space.set_decrypted_region(0x0000, 0xffff, decrypt);
@ -3178,13 +3172,13 @@ DRIVER_INIT_MEMBER(galaxian_state,mshuttle)
}; };
/* video extensions */ /* video extensions */
common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info); common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info);
/* IRQ line is INT, not NMI */ /* IRQ line is INT, not NMI */
m_irq_line = 0; m_irq_line = 0;
/* decrypt the code */ /* decrypt the code */
mshuttle_decode(machine(), convtable); mshuttle_decode(convtable);
} }
@ -3203,20 +3197,20 @@ DRIVER_INIT_MEMBER(galaxian_state,mshuttlj)
}; };
/* video extensions */ /* video extensions */
common_init(machine(), mshuttle_draw_bullet, galaxian_draw_background, mshuttle_extend_tile_info, mshuttle_extend_sprite_info); common_init(&galaxian_state::mshuttle_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mshuttle_extend_tile_info, &galaxian_state::mshuttle_extend_sprite_info);
/* IRQ line is INT, not NMI */ /* IRQ line is INT, not NMI */
m_irq_line = 0; m_irq_line = 0;
/* decrypt the code */ /* decrypt the code */
mshuttle_decode(machine(), convtable); mshuttle_decode(convtable);
} }
DRIVER_INIT_MEMBER(galaxian_state,fantastc) DRIVER_INIT_MEMBER(galaxian_state,fantastc)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, &galaxian_state::upper_extend_sprite_info);
/* two sprite generators */ /* two sprite generators */
m_numspritegens = 2; m_numspritegens = 2;
@ -3251,7 +3245,7 @@ DRIVER_INIT_MEMBER(galaxian_state,kingball)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
/* disable the stars */ /* disable the stars */
space.unmap_write(0xb004, 0xb004, 0, 0x07f8); space.unmap_write(0xb004, 0xb004, 0, 0x07f8);
@ -3271,7 +3265,7 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpnmc)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
/* move the interrupt enable from $b000 to $b001 */ /* move the interrupt enable from $b000 to $b001 */
space.unmap_write(0xb000, 0xb000, 0, 0x7f8); space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
@ -3292,7 +3286,7 @@ DRIVER_INIT_MEMBER(galaxian_state,thepitm)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::mooncrst_extend_tile_info, &galaxian_state::mooncrst_extend_sprite_info);
/* move the interrupt enable from $b000 to $b001 */ /* move the interrupt enable from $b000 to $b001 */
space.unmap_write(0xb000, 0xb000, 0, 0x7f8); space.unmap_write(0xb000, 0xb000, 0, 0x7f8);
@ -3316,7 +3310,7 @@ DRIVER_INIT_MEMBER(galaxian_state,theend)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), theend_draw_bullet, galaxian_draw_background, NULL, NULL); common_init(&galaxian_state::theend_draw_bullet, &galaxian_state::galaxian_draw_background, NULL, NULL);
/* coin counter on the upper bit of port C */ /* coin counter on the upper bit of port C */
space.unmap_write(0x6802, 0x6802, 0, 0x7f8); space.unmap_write(0x6802, 0x6802, 0, 0x7f8);
@ -3326,7 +3320,7 @@ DRIVER_INIT_MEMBER(galaxian_state,theend)
DRIVER_INIT_MEMBER(galaxian_state,scramble) DRIVER_INIT_MEMBER(galaxian_state,scramble)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
} }
@ -3335,7 +3329,7 @@ DRIVER_INIT_MEMBER(galaxian_state,explorer)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
/* watchdog works for writes as well? (or is it just disabled?) */ /* watchdog works for writes as well? (or is it just disabled?) */
space.install_write_handler(0x7000, 0x7000, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::watchdog_reset_w),this)); space.install_write_handler(0x7000, 0x7000, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::watchdog_reset_w),this));
@ -3354,7 +3348,7 @@ DRIVER_INIT_MEMBER(galaxian_state,explorer)
DRIVER_INIT_MEMBER(galaxian_state,sfx) DRIVER_INIT_MEMBER(galaxian_state,sfx)
{ {
/* basic configuration */ /* basic configuration */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, upper_extend_tile_info, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::upper_extend_tile_info, NULL);
m_sfx_tilemap = TRUE; m_sfx_tilemap = TRUE;
/* sound board has space for extra ROM */ /* sound board has space for extra ROM */
@ -3368,7 +3362,7 @@ DRIVER_INIT_MEMBER(galaxian_state,atlantis)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
/* watchdog is at $7800? (or is it just disabled?) */ /* watchdog is at $7800? (or is it just disabled?) */
space.unmap_read(0x7000, 0x7000, 0, 0x7ff); space.unmap_read(0x7000, 0x7000, 0, 0x7ff);
@ -3379,29 +3373,29 @@ DRIVER_INIT_MEMBER(galaxian_state,atlantis)
DRIVER_INIT_MEMBER(galaxian_state,scobra) DRIVER_INIT_MEMBER(galaxian_state,scobra)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
} }
DRIVER_INIT_MEMBER(galaxian_state,losttomb) DRIVER_INIT_MEMBER(galaxian_state,losttomb)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
/* decrypt */ /* decrypt */
decode_losttomb_gfx(machine()); decode_losttomb_gfx();
} }
DRIVER_INIT_MEMBER(galaxian_state,frogger) DRIVER_INIT_MEMBER(galaxian_state,frogger)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
m_frogger_adjust = TRUE; m_frogger_adjust = TRUE;
/* decrypt */ /* decrypt */
decode_frogger_sound(machine()); decode_frogger_sound();
decode_frogger_gfx(machine()); decode_frogger_gfx();
} }
@ -3410,7 +3404,7 @@ DRIVER_INIT_MEMBER(galaxian_state,froggrmc)
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
/* video extensions */ /* video extensions */
common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
space.install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),this)); space.install_write_handler(0xa800, 0xa800, 0, 0x7ff, write8_delegate(FUNC(galaxian_state::soundlatch_byte_w),this));
space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::froggrmc_sound_control_w),this)); space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::froggrmc_sound_control_w),this));
@ -3419,24 +3413,24 @@ DRIVER_INIT_MEMBER(galaxian_state,froggrmc)
space.install_ram(0x8000, 0x87ff); space.install_ram(0x8000, 0x87ff);
/* decrypt */ /* decrypt */
decode_frogger_sound(machine()); decode_frogger_sound();
} }
DRIVER_INIT_MEMBER(galaxian_state,froggers) DRIVER_INIT_MEMBER(galaxian_state,froggers)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
/* decrypt */ /* decrypt */
decode_frogger_sound(machine()); decode_frogger_sound();
} }
DRIVER_INIT_MEMBER(galaxian_state,turtles) DRIVER_INIT_MEMBER(galaxian_state,turtles)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), NULL, turtles_draw_background, NULL, NULL); common_init(NULL, &galaxian_state::turtles_draw_background, NULL, NULL);
} }
@ -3445,7 +3439,7 @@ DRIVER_INIT_MEMBER(galaxian_state,amidar)
{ {
/* no existing amidar sets run on Amidar hardware as described by Amidar schematics! */ /* no existing amidar sets run on Amidar hardware as described by Amidar schematics! */
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, amidar_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::amidar_draw_background, NULL, NULL);
} }
#endif #endif
@ -3454,7 +3448,7 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpion)
{ {
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
common_init(machine(), scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
/* hook up AY8910 */ /* hook up AY8910 */
machine().device("audiocpu")->memory().space(AS_IO).install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this)); machine().device("audiocpu")->memory().space(AS_IO).install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this));
@ -3490,41 +3484,41 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpion)
DRIVER_INIT_MEMBER(galaxian_state,anteater) DRIVER_INIT_MEMBER(galaxian_state,anteater)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL);
/* decode graphics */ /* decode graphics */
decode_anteater_gfx(machine()); decode_anteater_gfx();
} }
DRIVER_INIT_MEMBER(galaxian_state,anteateruk) DRIVER_INIT_MEMBER(galaxian_state,anteateruk)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, anteater_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::anteater_draw_background, NULL, NULL);
} }
DRIVER_INIT_MEMBER(galaxian_state,superbon) DRIVER_INIT_MEMBER(galaxian_state,superbon)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
/* decode code */ /* decode code */
decode_superbon(machine()); decode_superbon();
} }
DRIVER_INIT_MEMBER(galaxian_state,calipso) DRIVER_INIT_MEMBER(galaxian_state,calipso)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, calipso_extend_sprite_info); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, &galaxian_state::calipso_extend_sprite_info);
} }
DRIVER_INIT_MEMBER(galaxian_state,moonwar) DRIVER_INIT_MEMBER(galaxian_state,moonwar)
{ {
/* video extensions */ /* video extensions */
common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); common_init(&galaxian_state::scramble_draw_bullet, &galaxian_state::scramble_draw_background, NULL, NULL);
state_save_register_global(machine(), m_moonwar_port_select); state_save_register_global(machine(), m_moonwar_port_select);
} }
@ -3543,11 +3537,11 @@ DRIVER_INIT_MEMBER( galaxian_state, ghostmun )
DRIVER_INIT_MEMBER( galaxian_state, froggrs ) DRIVER_INIT_MEMBER( galaxian_state, froggrs )
{ {
/* video extensions */ /* video extensions */
common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); common_init(NULL, &galaxian_state::frogger_draw_background, &galaxian_state::frogger_extend_tile_info, &galaxian_state::frogger_extend_sprite_info);
/* decrypt */ /* decrypt */
decode_frogger_sound(machine()); decode_frogger_sound();
decode_frogger_gfx(machine()); decode_frogger_gfx();
} }

View File

@ -118,10 +118,10 @@ WRITE8_MEMBER(galpani2_state::galpani2_mcu_init_w)
machine().device("sub")->execute().set_input_line(INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised machine().device("sub")->execute().set_input_line(INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised
} }
static void galpani2_mcu_nmi1(running_machine &machine) void galpani2_state::galpani2_mcu_nmi1()
{ {
address_space &srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM); address_space &srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM);
address_space &dstspace = machine.device("sub")->memory().space(AS_PROGRAM); address_space &dstspace = machine().device("sub")->memory().space(AS_PROGRAM);
UINT32 mcu_list, mcu_command, mcu_address, mcu_extra, mcu_src, mcu_dst, mcu_size; UINT32 mcu_list, mcu_command, mcu_address, mcu_extra, mcu_src, mcu_dst, mcu_size;
for ( mcu_list = 0x100021; mcu_list < (0x100021 + 0x40); mcu_list += 4 ) for ( mcu_list = 0x100021; mcu_list < (0x100021 + 0x40); mcu_list += 4 )
@ -137,7 +137,7 @@ static void galpani2_mcu_nmi1(running_machine &machine)
if (mcu_command != 0) if (mcu_command != 0)
{ {
logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n", logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n",
machine.describe_context(), machine().describe_context(),
mcu_list, mcu_list,
srcspace.read_byte(0x100020), srcspace.read_byte(0x100020),
mcu_command, mcu_command,
@ -160,7 +160,7 @@ static void galpani2_mcu_nmi1(running_machine &machine)
mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) + mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) +
(srcspace.read_byte(mcu_address + 9)<<0) ; (srcspace.read_byte(mcu_address + 9)<<0) ;
logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine().describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
for( ; mcu_size > 0 ; mcu_size-- ) for( ; mcu_size > 0 ; mcu_size-- )
{ {
@ -185,7 +185,7 @@ static void galpani2_mcu_nmi1(running_machine &machine)
mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) + mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) +
(srcspace.read_byte(mcu_address + 9)<<0) ; (srcspace.read_byte(mcu_address + 9)<<0) ;
logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine().describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst);
for( ; mcu_size > 0 ; mcu_size-- ) for( ; mcu_size > 0 ; mcu_size-- )
{ {
@ -213,7 +213,7 @@ static void galpani2_mcu_nmi1(running_machine &machine)
srcspace.write_byte(mcu_address+0,0xff); srcspace.write_byte(mcu_address+0,0xff);
srcspace.write_byte(mcu_address+1,0xff); srcspace.write_byte(mcu_address+1,0xff);
logerror("%s : MCU ERROR, unknown command $%02X\n",machine.describe_context(),mcu_command); logerror("%s : MCU ERROR, unknown command $%02X\n",machine().describe_context(),mcu_command);
} }
/* Erase command (so that it won't be processed again)? */ /* Erase command (so that it won't be processed again)? */
@ -221,10 +221,10 @@ static void galpani2_mcu_nmi1(running_machine &machine)
} }
} }
static void galpani2_mcu_nmi2(running_machine &machine) void galpani2_state::galpani2_mcu_nmi2()
{ {
galpani2_write_kaneko(machine.device("maincpu")); galpani2_write_kaneko(machine().device("maincpu"));
//logerror("%s : MCU executes CHECKs synchro\n", machine.describe_context()); //logerror("%s : MCU executes CHECKs synchro\n", machine().describe_context());
} }
WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR
@ -233,7 +233,7 @@ WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR
//Triggered from 'maincpu' (00007D60),once, with no command, using alternate line, during init //Triggered from 'maincpu' (00007D60),once, with no command, using alternate line, during init
//Triggered from 'maincpu' (000080BE),once, for unknown command, during init //Triggered from 'maincpu' (000080BE),once, for unknown command, during init
//Triggered from 'maincpu' (0000741E),from here on...driven by int5, even if there's no command //Triggered from 'maincpu' (0000741E),from here on...driven by int5, even if there's no command
if ( (data & 1) && !(m_old_mcu_nmi1 & 1) ) galpani2_mcu_nmi1(machine()); if ( (data & 1) && !(m_old_mcu_nmi1 & 1) ) galpani2_mcu_nmi1();
//if ( (data & 0x10) && !(m_old_mcu_nmi1 & 0x10) ) galpani2_mcu_nmi1(machine()); //if ( (data & 0x10) && !(m_old_mcu_nmi1 & 0x10) ) galpani2_mcu_nmi1(machine());
//alternate line, same function? //alternate line, same function?
m_old_mcu_nmi1 = data; m_old_mcu_nmi1 = data;
@ -241,7 +241,7 @@ WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi1_w)//driven by CPU1's int5 ISR
WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi2_w)//driven by CPU2's int5 ISR WRITE8_MEMBER(galpani2_state::galpani2_mcu_nmi2_w)//driven by CPU2's int5 ISR
{ {
if ( (data & 1) && !(m_old_mcu_nmi2 & 1) ) galpani2_mcu_nmi2(machine()); if ( (data & 1) && !(m_old_mcu_nmi2 & 1) ) galpani2_mcu_nmi2();
m_old_mcu_nmi2 = data; m_old_mcu_nmi2 = data;
} }

View File

@ -82,14 +82,13 @@ WRITE16_MEMBER(gijoe_state::control2_w)
} }
} }
static void gijoe_objdma( running_machine &machine ) void gijoe_state::gijoe_objdma( )
{ {
gijoe_state *state = machine.driver_data<gijoe_state>();
UINT16 *src_head, *src_tail, *dst_head, *dst_tail; UINT16 *src_head, *src_tail, *dst_head, *dst_tail;
src_head = state->m_spriteram; src_head = m_spriteram;
src_tail = state->m_spriteram + 255 * 8; src_tail = m_spriteram + 255 * 8;
k053247_get_ram(state->m_k053246, &dst_head); k053247_get_ram(m_k053246, &dst_head);
dst_tail = dst_head + 255 * 8; dst_tail = dst_head + 255 * 8;
for (; src_head <= src_tail; src_head += 8) for (; src_head <= src_tail; src_head += 8)
@ -121,7 +120,7 @@ INTERRUPT_GEN_MEMBER(gijoe_state::gijoe_interrupt)
if (k053246_is_irq_enabled(m_k053246)) if (k053246_is_irq_enabled(m_k053246))
{ {
gijoe_objdma(machine()); gijoe_objdma();
// 42.7us(clr) + 341.3us(xfer) delay at 6Mhz dotclock // 42.7us(clr) + 341.3us(xfer) delay at 6Mhz dotclock
m_dmadelay_timer->adjust(JOE_DMADELAY); m_dmadelay_timer->adjust(JOE_DMADELAY);

View File

@ -982,7 +982,7 @@ ROM_START( gcastle )
ROM_END ROM_END
static void swap_block(UINT8 *src1,UINT8 *src2,int len) void gladiatr_state::swap_block(UINT8 *src1,UINT8 *src2,int len)
{ {
int i,t; int i,t;

View File

@ -284,15 +284,15 @@ ROM_END
***************************************************************************/ ***************************************************************************/
static void glass_ROM16_split_gfx( running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 ) void glass_state::glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 )
{ {
int i; int i;
/* get a pointer to the source data */ /* get a pointer to the source data */
UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base(); UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base();
/* get a pointer to the destination data */ /* get a pointer to the destination data */
UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base(); UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base();
/* fill destination areas with the proper data */ /* fill destination areas with the proper data */
for (i = 0; i < length / 2; i++) for (i = 0; i < length / 2; i++)
@ -404,10 +404,10 @@ DRIVER_INIT_MEMBER(glass_state,glass)
*/ */
/* split ROM H13 */ /* split ROM H13 */
glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000); glass_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0200000, 0x0000000, 0x0100000);
/* split ROM H11 */ /* split ROM H11 */
glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000); glass_ROM16_split_gfx("gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000);
/* install custom handler over RAM for protection */ /* install custom handler over RAM for protection */
machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this));

View File

@ -10906,7 +10906,7 @@ DRIVER_INIT_MEMBER(goldstar_state,goldstar)
// this block swapping is the same for chry10, chrygld and cb3 // this block swapping is the same for chry10, chrygld and cb3
// the underlying bitswaps / xors are different however // the underlying bitswaps / xors are different however
static void do_blockswaps(running_machine &machine, UINT8* ROM) void goldstar_state::do_blockswaps(UINT8* ROM)
{ {
int A; int A;
UINT8 *buffer; UINT8 *buffer;
@ -10925,7 +10925,7 @@ static void do_blockswaps(running_machine &machine, UINT8* ROM)
0xa000, 0xa800, 0xb000, 0xb800, 0xa000, 0xa800, 0xb000, 0xb800,
}; };
buffer = auto_alloc_array(machine, UINT8, 0x10000); buffer = auto_alloc_array(machine(), UINT8, 0x10000);
memcpy(buffer,ROM,0x10000); memcpy(buffer,ROM,0x10000);
// swap some 0x800 blocks around.. // swap some 0x800 blocks around..
@ -10934,16 +10934,16 @@ static void do_blockswaps(running_machine &machine, UINT8* ROM)
memcpy(ROM+A*0x800,buffer+cherry_swaptables[A],0x800); memcpy(ROM+A*0x800,buffer+cherry_swaptables[A],0x800);
} }
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
static void dump_to_file(running_machine& machine, UINT8* ROM) void goldstar_state::dump_to_file( UINT8* ROM)
{ {
#if 0 #if 0
{ {
FILE *fp; FILE *fp;
char filename[256]; char filename[256];
sprintf(filename,"decrypted_%s", machine.system().name); sprintf(filename,"decrypted_%s", machine().system().name);
fp=fopen(filename, "w+b"); fp=fopen(filename, "w+b");
if (fp) if (fp)
{ {
@ -10954,7 +10954,7 @@ static void dump_to_file(running_machine& machine, UINT8* ROM)
#endif #endif
} }
static UINT8 decrypt(UINT8 cipherText, UINT16 address) UINT8 goldstar_state::decrypt(UINT8 cipherText, UINT16 address)
{ {
int idx; int idx;
UINT8 output; UINT8 output;
@ -10971,7 +10971,7 @@ static UINT8 decrypt(UINT8 cipherText, UINT16 address)
return output ^ sbox[idx]; return output ^ sbox[idx];
} }
static UINT8 chry10_decrypt(UINT8 cipherText) UINT8 goldstar_state::chry10_decrypt(UINT8 cipherText)
{ {
return cipherText ^ (BIT(cipherText, 4) << 3) ^ (BIT(cipherText, 1) << 5) ^ (BIT(cipherText, 6) << 7); return cipherText ^ (BIT(cipherText, 4) << 3) ^ (BIT(cipherText, 1) << 5) ^ (BIT(cipherText, 6) << 7);
} }
@ -10989,7 +10989,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chry10)
ROM[i] = chry10_decrypt(ROM[i]); ROM[i] = chry10_decrypt(ROM[i]);
} }
do_blockswaps(machine(), ROM); do_blockswaps(ROM);
/* The game has a PIC for protection. /* The game has a PIC for protection.
If the code enter to this sub, just If the code enter to this sub, just
@ -10997,7 +10997,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chry10)
*/ */
ROM[0xA5DC] = 0xc9; ROM[0xA5DC] = 0xc9;
dump_to_file(machine(), ROM); dump_to_file(ROM);
} }
DRIVER_INIT_MEMBER(goldstar_state,cb3) DRIVER_INIT_MEMBER(goldstar_state,cb3)
@ -11013,8 +11013,8 @@ DRIVER_INIT_MEMBER(goldstar_state,cb3)
ROM[i] = decrypt(ROM[i], i); ROM[i] = decrypt(ROM[i], i);
} }
do_blockswaps(machine(), ROM); do_blockswaps(ROM);
dump_to_file(machine(), ROM); dump_to_file(ROM);
} }
@ -11022,7 +11022,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chrygld)
{ {
int A; int A;
UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); UINT8 *ROM = machine().root_device().memregion("maincpu")->base();
do_blockswaps(machine(), ROM); do_blockswaps(ROM);
// a data bitswap // a data bitswap
for (A = 0;A < 0x10000;A++) for (A = 0;A < 0x10000;A++)
@ -11032,7 +11032,7 @@ DRIVER_INIT_MEMBER(goldstar_state,chrygld)
ROM[A] = dat; ROM[A] = dat;
} }
dump_to_file(machine(), ROM); dump_to_file(ROM);
} }
DRIVER_INIT_MEMBER(goldstar_state,cm) DRIVER_INIT_MEMBER(goldstar_state,cm)

View File

@ -483,63 +483,63 @@ TIMER_CALLBACK_MEMBER(gottlieb_state::laserdisc_bit_callback)
* *
*************************************/ *************************************/
INLINE void audio_end_state(gottlieb_state *state) inline void gottlieb_state::audio_end_state()
{ {
/* this occurs either when the "break in transmission" condition is hit (no zero crossings /* this occurs either when the "break in transmission" condition is hit (no zero crossings
for 400usec) or when the entire audio buffer is full */ for 400usec) or when the entire audio buffer is full */
state->m_laserdisc_status |= 0x08; m_laserdisc_status |= 0x08;
state->m_laserdisc_audio_bit_count = 0; m_laserdisc_audio_bit_count = 0;
state->m_laserdisc_audio_address = 0; m_laserdisc_audio_address = 0;
if (state->m_laserdisc_audio_address != 0) if (m_laserdisc_audio_address != 0)
printf("Got %d bytes\n", state->m_laserdisc_audio_address); printf("Got %d bytes\n", m_laserdisc_audio_address);
} }
static void audio_process_clock(gottlieb_state *state, int logit) void gottlieb_state::audio_process_clock(int logit)
{ {
/* clock the bit through the shift register */ /* clock the bit through the shift register */
state->m_laserdisc_audio_bits >>= 1; m_laserdisc_audio_bits >>= 1;
if (state->m_laserdisc_zero_seen) if (m_laserdisc_zero_seen)
state->m_laserdisc_audio_bits |= 0x80; m_laserdisc_audio_bits |= 0x80;
state->m_laserdisc_zero_seen = 0; m_laserdisc_zero_seen = 0;
/* if the buffer ready flag is set, then we are looking for the magic $67 pattern */ /* if the buffer ready flag is set, then we are looking for the magic $67 pattern */
if (state->m_laserdisc_status & 0x08) if (m_laserdisc_status & 0x08)
{ {
if (state->m_laserdisc_audio_bits == 0x67) if (m_laserdisc_audio_bits == 0x67)
{ {
if (logit) if (logit)
logerror(" -- got 0x67"); logerror(" -- got 0x67");
state->m_laserdisc_status &= ~0x08; m_laserdisc_status &= ~0x08;
state->m_laserdisc_audio_address = 0; m_laserdisc_audio_address = 0;
} }
} }
/* otherwise, we keep clocking bytes into the audio buffer */ /* otherwise, we keep clocking bytes into the audio buffer */
else else
{ {
state->m_laserdisc_audio_bit_count++; m_laserdisc_audio_bit_count++;
/* if we collect 8 bits, add to the buffer */ /* if we collect 8 bits, add to the buffer */
if (state->m_laserdisc_audio_bit_count == 8) if (m_laserdisc_audio_bit_count == 8)
{ {
if (logit) if (logit)
logerror(" -- got new byte %02X", state->m_laserdisc_audio_bits); logerror(" -- got new byte %02X", m_laserdisc_audio_bits);
state->m_laserdisc_audio_bit_count = 0; m_laserdisc_audio_bit_count = 0;
state->m_laserdisc_audio_buffer[state->m_laserdisc_audio_address++] = state->m_laserdisc_audio_bits; m_laserdisc_audio_buffer[m_laserdisc_audio_address++] = m_laserdisc_audio_bits;
/* if we collect a full buffer, signal */ /* if we collect a full buffer, signal */
if (state->m_laserdisc_audio_address >= AUDIORAM_SIZE) if (m_laserdisc_audio_address >= AUDIORAM_SIZE)
audio_end_state(state); audio_end_state();
} }
} }
} }
static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, int logit) void gottlieb_state::audio_handle_zero_crossing(attotime zerotime, int logit)
{ {
/* compute time from last clock */ /* compute time from last clock */
attotime deltaclock = zerotime - state->m_laserdisc_last_clock; attotime deltaclock = zerotime - m_laserdisc_last_clock;
if (logit) if (logit)
logerror(" -- zero @ %s (delta=%s)", zerotime.as_string(6), deltaclock.as_string(6)); logerror(" -- zero @ %s (delta=%s)", zerotime.as_string(6), deltaclock.as_string(6));
@ -548,7 +548,7 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime,
{ {
if (logit) if (logit)
logerror(" -- count as bit"); logerror(" -- count as bit");
state->m_laserdisc_zero_seen++; m_laserdisc_zero_seen++;
return; return;
} }
@ -556,8 +556,8 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime,
else if (deltaclock < attotime::from_usec(215)) else if (deltaclock < attotime::from_usec(215))
{ {
if (logit) if (logit)
logerror(" -- clock, bit=%d", state->m_laserdisc_zero_seen); logerror(" -- clock, bit=%d", m_laserdisc_zero_seen);
state->m_laserdisc_last_clock = zerotime; m_laserdisc_last_clock = zerotime;
} }
/* if we are outside of 215usec, we are technically a missing clock /* if we are outside of 215usec, we are technically a missing clock
@ -567,7 +567,7 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime,
{ {
if (logit) if (logit)
logerror(" -- skewed clock, correcting"); logerror(" -- skewed clock, correcting");
state->m_laserdisc_last_clock += attotime::from_usec(200); m_laserdisc_last_clock += attotime::from_usec(200);
} }
/* we'll count anything more than 275us as an actual missing clock */ /* we'll count anything more than 275us as an actual missing clock */
@ -575,11 +575,11 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime,
{ {
if (logit) if (logit)
logerror(" -- missing clock"); logerror(" -- missing clock");
state->m_laserdisc_last_clock = zerotime; m_laserdisc_last_clock = zerotime;
} }
/* we have a clock, process it */ /* we have a clock, process it */
audio_process_clock(state, logit); audio_process_clock(logit);
} }
@ -612,7 +612,7 @@ static void laserdisc_audio_process(device_t *dummy, laserdisc_device &device, i
/* if we are past the "break in transmission" time, reset everything */ /* if we are past the "break in transmission" time, reset everything */
if ((curtime - state->m_laserdisc_last_clock) > attotime::from_usec(400)) if ((curtime - state->m_laserdisc_last_clock) > attotime::from_usec(400))
audio_end_state(state); state->audio_end_state();
/* if this sample reinforces that the previous one ended a zero crossing, count it */ /* if this sample reinforces that the previous one ended a zero crossing, count it */
if ((sample >= 256 && state->m_laserdisc_last_samples[1] >= 0 && state->m_laserdisc_last_samples[0] < 0) || if ((sample >= 256 && state->m_laserdisc_last_samples[1] >= 0 && state->m_laserdisc_last_samples[0] < 0) ||
@ -628,7 +628,7 @@ static void laserdisc_audio_process(device_t *dummy, laserdisc_device &device, i
zerotime = curtime + time_per_sample * fractime / 1000; zerotime = curtime + time_per_sample * fractime / 1000;
/* determine if this is a clock; if it is, process */ /* determine if this is a clock; if it is, process */
audio_handle_zero_crossing(state, zerotime, logit); state->audio_handle_zero_crossing(zerotime, logit);
} }
if (logit) if (logit)
logerror(" \n"); logerror(" \n");

View File

@ -87,10 +87,6 @@
/* constants */ /* constants */
#define FIRQ_SCANLINE 92 #define FIRQ_SCANLINE 92
/* local prototypes */
static void poly17_init(running_machine &machine);
/************************************* /*************************************
* *
* Interrupt handling * Interrupt handling
@ -142,7 +138,7 @@ void gridlee_state::machine_start()
m_maincpu = machine().device<cpu_device>("maincpu"); m_maincpu = machine().device<cpu_device>("maincpu");
/* create the polynomial tables */ /* create the polynomial tables */
poly17_init(machine()); poly17_init();
state_save_register_global_array(machine(), m_last_analog_input); state_save_register_global_array(machine(), m_last_analog_input);
state_save_register_global_array(machine(), m_last_analog_output); state_save_register_global_array(machine(), m_last_analog_output);
@ -221,15 +217,14 @@ READ8_MEMBER(gridlee_state::analog_port_r)
#define POLY17_SHR 10 #define POLY17_SHR 10
#define POLY17_ADD 0x18000 #define POLY17_ADD 0x18000
static void poly17_init(running_machine &machine) void gridlee_state::poly17_init()
{ {
gridlee_state *state = machine.driver_data<gridlee_state>();
UINT32 i, x = 0; UINT32 i, x = 0;
UINT8 *p, *r; UINT8 *p, *r;
/* allocate memory */ /* allocate memory */
p = state->m_poly17 = auto_alloc_array(machine, UINT8, 2 * (POLY17_SIZE + 1)); p = m_poly17 = auto_alloc_array(machine(), UINT8, 2 * (POLY17_SIZE + 1));
r = state->m_rand17 = state->m_poly17 + POLY17_SIZE + 1; r = m_rand17 = m_poly17 + POLY17_SIZE + 1;
/* generate the polynomial */ /* generate the polynomial */
for (i = 0; i < POLY17_SIZE; i++) for (i = 0; i < POLY17_SIZE; i++)

View File

@ -1018,36 +1018,35 @@ WRITE16_MEMBER(gstriker_state::vbl_toggle_w)
} }
} }
static void mcu_init( running_machine &machine ) void gstriker_state::mcu_init( )
{ {
gstriker_state *state = machine.driver_data<gstriker_state>(); m_dmmy_8f_ret = 0xFFFF;
state->m_dmmy_8f_ret = 0xFFFF; m_pending_command = 0;
state->m_pending_command = 0; m_mcu_data = 0;
state->m_mcu_data = 0;
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),state)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),this));
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),state)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),this));
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),state)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),this));
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),state)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),this));
} }
DRIVER_INIT_MEMBER(gstriker_state,twrldc94) DRIVER_INIT_MEMBER(gstriker_state,twrldc94)
{ {
m_gametype = 1; m_gametype = 1;
mcu_init( machine() ); mcu_init();
} }
DRIVER_INIT_MEMBER(gstriker_state,twrldc94a) DRIVER_INIT_MEMBER(gstriker_state,twrldc94a)
{ {
m_gametype = 2; m_gametype = 2;
mcu_init( machine() ); mcu_init();
} }
DRIVER_INIT_MEMBER(gstriker_state,vgoalsoc) DRIVER_INIT_MEMBER(gstriker_state,vgoalsoc)
{ {
m_gametype = 3; m_gametype = 3;
mcu_init( machine() ); mcu_init();
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this));

View File

@ -150,10 +150,10 @@ reg: 0->1 (main->2nd) / : (1->0) 2nd->main :
#if 0 #if 0
static int gsword_coins_in(void) int ::gsword_coins_in(void)
{ {
/* emulate 8741 coin slot */ /* emulate 8741 coin slot */
if (machine.root_device().ioport("IN4")->read() & 0xc0) if (machine().root_device().ioport("IN4")->read() & 0xc0)
{ {
logerror("Coin In\n"); logerror("Coin In\n");
return 0x80; return 0x80;

View File

@ -41,4 +41,5 @@ public:
DECLARE_VIDEO_START(maniacsq); DECLARE_VIDEO_START(maniacsq);
UINT32 screen_update_bigkarnk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_bigkarnk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_maniacsq(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_maniacsq(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -56,4 +56,7 @@ public:
DECLARE_WRITE16_MEMBER(gaelco2_eeprom_cs_w); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_cs_w);
DECLARE_WRITE16_MEMBER(gaelco2_eeprom_sk_w); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_sk_w);
DECLARE_WRITE16_MEMBER(gaelco2_eeprom_data_w); DECLARE_WRITE16_MEMBER(gaelco2_eeprom_data_w);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs);
UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index);
void gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2);
}; };

View File

@ -119,8 +119,5 @@ public:
INTERRUPT_GEN_MEMBER(vblank_gen); INTERRUPT_GEN_MEMBER(vblank_gen);
TIMER_CALLBACK_MEMBER(delayed_sound_w); TIMER_CALLBACK_MEMBER(delayed_sound_w);
TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq); TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq);
void gaelco3d_render(screen_device &screen);
}; };
/*----------- defined in video/gaelco3d.c -----------*/
void gaelco3d_render(screen_device &screen);

View File

@ -88,4 +88,9 @@ public:
UINT32 screen_update_gaiden(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_gaiden(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_drgnbowl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_drgnbowl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_raiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_raiga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void drgnbowl_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void descramble_drgnbowl_gfx();
void descramble_mastninj_gfx(UINT8* src);
void blendbitmaps(bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3,
int sx,int sy,const rectangle &cliprect);
}; };

View File

@ -61,6 +61,9 @@ public:
INTERRUPT_GEN_MEMBER(main_vblank_irq); INTERRUPT_GEN_MEMBER(main_vblank_irq);
INTERRUPT_GEN_MEMBER(sub_vblank_irq); INTERRUPT_GEN_MEMBER(sub_vblank_irq);
TIMER_CALLBACK_MEMBER(cpu3_interrupt_callback); TIMER_CALLBACK_MEMBER(cpu3_interrupt_callback);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect );
void bosco_latch_reset();
}; };
class xevious_state : public galaga_state class xevious_state : public galaga_state
@ -98,6 +101,7 @@ public:
UINT32 screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(battles_interrupt_4); INTERRUPT_GEN_MEMBER(battles_interrupt_4);
TIMER_DEVICE_CALLBACK_MEMBER(battles_nmi_generate); TIMER_DEVICE_CALLBACK_MEMBER(battles_nmi_generate);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
}; };
@ -129,6 +133,11 @@ public:
DECLARE_PALETTE_INIT(bosco); DECLARE_PALETTE_INIT(bosco);
UINT32 screen_update_bosco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_bosco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_bosco(screen_device &screen, bool state); void screen_eof_bosco(screen_device &screen, bool state);
inline void get_tile_info_bosco(tile_data &tileinfo,int tile_index,int ram_offs);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip);
}; };
class digdug_state : public galaga_state class digdug_state : public galaga_state
@ -155,6 +164,7 @@ public:
DECLARE_VIDEO_START(digdug); DECLARE_VIDEO_START(digdug);
DECLARE_PALETTE_INIT(digdug); DECLARE_PALETTE_INIT(digdug);
UINT32 screen_update_digdug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_digdug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
}; };
/*----------- defined in video/bosco.c -----------*/ /*----------- defined in video/bosco.c -----------*/

View File

@ -51,4 +51,7 @@ public:
INTERRUPT_GEN_MEMBER(galastrm_interrupt); INTERRUPT_GEN_MEMBER(galastrm_interrupt);
TIMER_CALLBACK_MEMBER(galastrm_interrupt6); TIMER_CALLBACK_MEMBER(galastrm_interrupt6);
void galastrm_exit(); void galastrm_exit();
void draw_sprites_pre(int x_offs, int y_offs);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority);
void tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip);
}; };

View File

@ -27,12 +27,6 @@
#define GALAXIAN_VBEND (16) #define GALAXIAN_VBEND (16)
#define GALAXIAN_VBSTART (224+16) #define GALAXIAN_VBSTART (224+16)
/* video extension callbacks */
typedef void (*galaxian_extend_tile_info_func)(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
typedef void (*galaxian_extend_sprite_info_func)(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
typedef void (*galaxian_draw_bullet_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
typedef void (*galaxian_draw_background_func)(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
class galaxian_state : public driver_device class galaxian_state : public driver_device
{ {
@ -70,10 +64,18 @@ public:
int m_tenspot_current_game; int m_tenspot_current_game;
UINT8 m_frogger_adjust; UINT8 m_frogger_adjust;
UINT8 m_sfx_tilemap; UINT8 m_sfx_tilemap;
/* video extension callbacks */
typedef void (galaxian_state::*galaxian_extend_tile_info_func)(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
typedef void (galaxian_state::*galaxian_extend_sprite_info_func)(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
typedef void (galaxian_state::*galaxian_draw_bullet_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
typedef void (galaxian_state::*galaxian_draw_background_func)(bitmap_rgb32 &bitmap, const rectangle &cliprect);
galaxian_extend_tile_info_func m_extend_tile_info_ptr; galaxian_extend_tile_info_func m_extend_tile_info_ptr;
galaxian_extend_sprite_info_func m_extend_sprite_info_ptr; galaxian_extend_sprite_info_func m_extend_sprite_info_ptr;
galaxian_draw_bullet_func m_draw_bullet_ptr; galaxian_draw_bullet_func m_draw_bullet_ptr;
galaxian_draw_background_func m_draw_background_ptr; galaxian_draw_background_func m_draw_background_ptr;
tilemap_t *m_bg_tilemap; tilemap_t *m_bg_tilemap;
UINT8 m_flipscreen_x; UINT8 m_flipscreen_x;
UINT8 m_flipscreen_y; UINT8 m_flipscreen_y;
@ -230,60 +232,56 @@ public:
INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen); INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen);
TIMER_DEVICE_CALLBACK_MEMBER(checkmaj_irq0_gen); TIMER_DEVICE_CALLBACK_MEMBER(checkmaj_irq0_gen);
TIMER_DEVICE_CALLBACK_MEMBER(galaxian_stars_blink_timer); TIMER_DEVICE_CALLBACK_MEMBER(galaxian_stars_blink_timer);
void state_save_register();
void sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase);
void bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base);
void stars_init();
void stars_update_origin();
void stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask);
void galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped);
void scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx);
void scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect);
void amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect);
inline void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color);
void galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
void monsterz_set_latch();
void decode_mooncrst(int length, UINT8 *dest);
void decode_checkman();
void decode_dingoe();
void decode_frogger_sound();
void decode_frogger_gfx();
void decode_anteater_gfx();
void decode_losttomb_gfx();
void decode_superbon();
void unmap_galaxian_sound(offs_t base);
void mshuttle_decode(const UINT8 convtable[8][16]);
void common_init(galaxian_draw_bullet_func draw_bullet,galaxian_draw_background_func draw_background,
galaxian_extend_tile_info_func extend_tile_info,galaxian_extend_sprite_info_func extend_sprite_info);
}; };
/*----------- defined in video/galaxian.c -----------*/
/* special purpose background rendering */
void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
//void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect);
/* special purpose bullet rendering */
void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y);
/* generic extensions */
void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Frogger extensions */
void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Ghostmuncher Galaxian extensions */
void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Pisces extensions */
void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Batman Part 2 extensions */
void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
/* Moon Cresta extensions */
void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Moon Quasar extensions */
void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Moon Shuttle extensions */
void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Calipso extensions */
void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);
/* Jumpbug extensions */
void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x);
void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color);

View File

@ -54,20 +54,20 @@ public:
UINT8 m_color_mask; UINT8 m_color_mask;
tilemap_t *m_dambustr_tilemap2; tilemap_t *m_dambustr_tilemap2;
UINT8 *m_dambustr_videoram2; UINT8 *m_dambustr_videoram2;
void (*m_modify_charcode)(running_machine &machine, UINT16 *code, UINT8 x); /* function to call to do character banking */ void (galaxold_state::*m_modify_charcode)(UINT16 *code, UINT8 x); /* function to call to do character banking */
void (*m_modify_spritecode)(running_machine &machine, UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */ void (galaxold_state::*m_modify_spritecode)(UINT8 *spriteram, int*, int*, int*, int); /* function to call to do sprite banking */
void (*m_modify_color)(UINT8 *color); /* function to call to do modify how the color codes map to the PROM */ void (galaxold_state::*m_modify_color)(UINT8 *color); /* function to call to do modify how the color codes map to the PROM */
void (*m_modify_ypos)(UINT8*); /* function to call to do modify how vertical positioning bits are connected */ void (galaxold_state::*m_modify_ypos)(UINT8*); /* function to call to do modify how vertical positioning bits are connected */
UINT8 m_timer_adjusted; UINT8 m_timer_adjusted;
UINT8 m_darkplnt_bullet_color; UINT8 m_darkplnt_bullet_color;
void (*m_draw_bullets)(running_machine &,bitmap_ind16 &,const rectangle &, int, int, int); /* function to call to draw a bullet */ void (galaxold_state::*m_draw_bullets)(bitmap_ind16 &,const rectangle &, int, int, int); /* function to call to draw a bullet */
UINT8 m_background_enable; UINT8 m_background_enable;
UINT8 m_background_red; UINT8 m_background_red;
UINT8 m_background_green; UINT8 m_background_green;
UINT8 m_background_blue; UINT8 m_background_blue;
void (*m_draw_background)(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect); /* function to call to draw the background */ void (galaxold_state::*m_draw_background)(bitmap_ind16 &bitmap, const rectangle &cliprect); /* function to call to draw the background */
UINT16 m_rockclim_v; UINT16 m_rockclim_v;
UINT16 m_rockclim_h; UINT16 m_rockclim_h;
int m_dambustr_bg_split_line; int m_dambustr_bg_split_line;
@ -77,7 +77,7 @@ public:
int m_dambustr_char_bank; int m_dambustr_char_bank;
bitmap_ind16 *m_dambustr_tmpbitmap; bitmap_ind16 *m_dambustr_tmpbitmap;
void (*m_draw_stars)(running_machine &machine, bitmap_ind16 &, const rectangle &); /* function to call to draw the star layer */ void (galaxold_state::*m_draw_stars)(bitmap_ind16 &, const rectangle &); /* function to call to draw the star layer */
int m_stars_colors_start; int m_stars_colors_start;
INT32 m_stars_scrollpos; INT32 m_stars_scrollpos;
UINT8 m_stars_on; UINT8 m_stars_on;
@ -188,12 +188,57 @@ public:
DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_1_callback); DECLARE_WRITE_LINE_MEMBER(galaxold_7474_9m_1_callback);
DECLARE_VIDEO_START(bagmanmc); DECLARE_VIDEO_START(bagmanmc);
IRQ_CALLBACK_MEMBER(hunchbkg_irq_callback); IRQ_CALLBACK_MEMBER(hunchbkg_irq_callback);
void state_save_register();
void video_start_common();
void pisces_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void theend_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void mooncrst_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void batman2_modify_charcode(UINT16 *code, UINT8 x);
void rockclim_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void rockclim_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void harem_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void mooncrst_modify_charcode(UINT16 *code, UINT8 x);
void pisces_modify_charcode(UINT16 *code, UINT8 x);
void mimonkey_modify_charcode(UINT16 *code, UINT8 x);
void mariner_modify_charcode(UINT16 *code, UINT8 x);
void dambustr_modify_charcode(UINT16 *code, UINT8 x);
void mshuttle_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void mimonkey_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void batman2_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void dkongjrm_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void ad2083_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void dambustr_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void drivfrcg_modify_color(UINT8 *color);
void galaxold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void scrambold_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void darkplnt_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void dambustr_draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int x, int y);
void galaxold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void scrambold_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void ad2083_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void stratgyx_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void minefld_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void rescue_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void mariner_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void dambustr_draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void dambustr_draw_upper_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void galaxold_init_stars(int colors_offset);
void plot_star(bitmap_ind16 &bitmap, int x, int y, int color, const rectangle &cliprect);
void noop_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
void galaxold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
void scrambold_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
void rescue_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
void mariner_draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect);
void start_stars_blink_timer(double ra, double rb, double c);
void start_stars_scroll_timer();
void draw_bullets_common(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, UINT8 *spriteram, size_t spriteram_size);
void bagmanmc_modify_charcode(UINT16 *code, UINT8 x);
void bagmanmc_modify_spritecode(UINT8 *spriteram, int *code, int *flipx, int *flipy, int offs);
void machine_reset_common(int line);
UINT8 decode_mooncrst(UINT8 data,offs_t addr);
}; };
/*----------- defined in video/galaxold.c -----------*/
void galaxold_init_stars(running_machine &machine, int colors_offset);
void galaxold_draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect);
#define galaxold_coin_counter_0_w galaxold_coin_counter_w #define galaxold_coin_counter_0_w galaxold_coin_counter_w
#endif #endif

View File

@ -58,6 +58,7 @@ public:
DECLARE_VIDEO_START(ninjemak); DECLARE_VIDEO_START(ninjemak);
UINT32 screen_update_galivan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_galivan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_ninjemak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ninjemak(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };
/*----------- defined in video/galivan.c -----------*/ /*----------- defined in video/galivan.c -----------*/

View File

@ -53,6 +53,8 @@ public:
UINT32 screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_galpani2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt1); TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt1);
TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt2); TIMER_DEVICE_CALLBACK_MEMBER(galpani2_interrupt2);
void galpani2_mcu_nmi1();
void galpani2_mcu_nmi2();
}; };

View File

@ -29,6 +29,8 @@ public:
void screen_eof_galpanic(screen_device &screen, bool state); void screen_eof_galpanic(screen_device &screen, bool state);
TIMER_DEVICE_CALLBACK_MEMBER(galpanic_scanline); TIMER_DEVICE_CALLBACK_MEMBER(galpanic_scanline);
TIMER_DEVICE_CALLBACK_MEMBER(galhustl_scanline); TIMER_DEVICE_CALLBACK_MEMBER(galhustl_scanline);
void comad_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
}; };
/*----------- defined in video/galpanic.c -----------*/ /*----------- defined in video/galpanic.c -----------*/

View File

@ -32,4 +32,5 @@ public:
virtual void machine_start(); virtual void machine_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_galspnbl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_galspnbl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -79,6 +79,8 @@ public:
DECLARE_WRITE8_MEMBER(leprechn_video_command_w); DECLARE_WRITE8_MEMBER(leprechn_video_command_w);
DECLARE_WRITE_LINE_MEMBER(video_command_trigger_w); DECLARE_WRITE_LINE_MEMBER(video_command_trigger_w);
DECLARE_READ8_MEMBER(vblank_r); DECLARE_READ8_MEMBER(vblank_r);
void gameplan_get_pens( pen_t *pens );
void leprechn_get_pens( pen_t *pens );
}; };
/*----------- defined in video/gameplan.c -----------*/ /*----------- defined in video/gameplan.c -----------*/

View File

@ -51,4 +51,7 @@ public:
INTERRUPT_GEN_MEMBER(gaplus_vblank_sub_irq); INTERRUPT_GEN_MEMBER(gaplus_vblank_sub_irq);
INTERRUPT_GEN_MEMBER(gaplus_vblank_sub2_irq); INTERRUPT_GEN_MEMBER(gaplus_vblank_sub2_irq);
TIMER_CALLBACK_MEMBER(namcoio_run); TIMER_CALLBACK_MEMBER(namcoio_run);
void starfield_init();
void starfield_render(bitmap_ind16 &bitmap);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -58,4 +58,6 @@ public:
UINT32 screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(gberet_interrupt_tick); TIMER_DEVICE_CALLBACK_MEMBER(gberet_interrupt_tick);
void gberet_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void gberetb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -62,4 +62,6 @@ public:
INTERRUPT_GEN_MEMBER(gcpinbal_interrupt); INTERRUPT_GEN_MEMBER(gcpinbal_interrupt);
TIMER_CALLBACK_MEMBER(gcpinbal_interrupt1); TIMER_CALLBACK_MEMBER(gcpinbal_interrupt1);
TIMER_CALLBACK_MEMBER(gcpinbal_interrupt3); TIMER_CALLBACK_MEMBER(gcpinbal_interrupt3);
void gcpinbal_core_vh_start( );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs );
}; };

View File

@ -47,6 +47,7 @@ public:
UINT32 screen_update_gijoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gijoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(gijoe_interrupt); INTERRUPT_GEN_MEMBER(gijoe_interrupt);
TIMER_CALLBACK_MEMBER(dmaend_callback); TIMER_CALLBACK_MEMBER(dmaend_callback);
void gijoe_objdma( );
}; };
/*----------- defined in video/gijoe.c -----------*/ /*----------- defined in video/gijoe.c -----------*/

View File

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

View File

@ -66,4 +66,6 @@ public:
DECLARE_VIDEO_START(gladiatr); DECLARE_VIDEO_START(gladiatr);
UINT32 screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gladiatr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void swap_block(UINT8 *src1,UINT8 *src2,int len);
}; };

View File

@ -48,4 +48,6 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_glass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(glass_interrupt); INTERRUPT_GEN_MEMBER(glass_interrupt);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void glass_ROM16_split_gfx( const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2 );
}; };

View File

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

View File

@ -53,4 +53,5 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_goal92(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_goal92(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_goal92(screen_device &screen, bool state); void screen_eof_goal92(screen_device &screen, bool state);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
}; };

View File

@ -48,4 +48,5 @@ public:
virtual void machine_reset(); virtual void machine_reset();
virtual void video_start(); virtual void video_start();
UINT32 screen_update_goindol(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_goindol(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram );
}; };

View File

@ -150,4 +150,8 @@ public:
UINT32 screen_update_amcoe1a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_amcoe1a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_unkch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_unkch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(lucky8_irq); INTERRUPT_GEN_MEMBER(lucky8_irq);
void do_blockswaps(UINT8* ROM);
void dump_to_file( UINT8* ROM);
UINT8 decrypt(UINT8 cipherText, UINT16 address);
UINT8 chry10_decrypt(UINT8 cipherText);
}; };

View File

@ -47,4 +47,5 @@ public:
virtual void machine_reset(); virtual void machine_reset();
virtual void video_start(); virtual void video_start();
UINT32 screen_update_gotcha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gotcha(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void get_tile_info( tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs);
}; };

View File

@ -314,6 +314,10 @@ public:
TIMER_CALLBACK_MEMBER(laserdisc_bit_off_callback); TIMER_CALLBACK_MEMBER(laserdisc_bit_off_callback);
TIMER_CALLBACK_MEMBER(laserdisc_bit_callback); TIMER_CALLBACK_MEMBER(laserdisc_bit_callback);
TIMER_CALLBACK_MEMBER(nmi_clear); TIMER_CALLBACK_MEMBER(nmi_clear);
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
inline void audio_end_state();
void audio_process_clock(int logit);
void audio_handle_zero_crossing(attotime zerotime, int logit);
}; };
/*----------- defined in audio/gottlieb.c -----------*/ /*----------- defined in audio/gottlieb.c -----------*/

View File

@ -38,4 +38,7 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_status_row( bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -75,6 +75,7 @@ public:
INTERRUPT_GEN_MEMBER(grchamp_cpu0_interrupt); INTERRUPT_GEN_MEMBER(grchamp_cpu0_interrupt);
INTERRUPT_GEN_MEMBER(grchamp_cpu1_interrupt); INTERRUPT_GEN_MEMBER(grchamp_cpu1_interrupt);
TIMER_CALLBACK_MEMBER(main_to_sub_comm_sync_w); TIMER_CALLBACK_MEMBER(main_to_sub_comm_sync_w);
void draw_objects(int y, UINT8 *objdata);
}; };
/* Discrete Sound Input Nodes */ /* Discrete Sound Input Nodes */

View File

@ -61,6 +61,7 @@ public:
TIMER_CALLBACK_MEMBER(firq_off_tick); TIMER_CALLBACK_MEMBER(firq_off_tick);
TIMER_CALLBACK_MEMBER(firq_timer_tick); TIMER_CALLBACK_MEMBER(firq_timer_tick);
void expand_pixels(); void expand_pixels();
void poly17_init();
}; };

View File

@ -40,4 +40,5 @@ public:
UINT32 screen_update_groundfx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_groundfx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(groundfx_interrupt); INTERRUPT_GEN_MEMBER(groundfx_interrupt);
TIMER_CALLBACK_MEMBER(groundfx_interrupt5); TIMER_CALLBACK_MEMBER(groundfx_interrupt5);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs);
}; };

View File

@ -99,6 +99,17 @@ public:
DECLARE_VIDEO_START(vgoalsoc); DECLARE_VIDEO_START(vgoalsoc);
DECLARE_VIDEO_START(twrldc94); DECLARE_VIDEO_START(twrldc94);
UINT32 screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gstriker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void VS920A_init(int numchips);
tilemap_t* VS920A_get_tilemap(int numchip);
void VS920A_set_pal_base(int numchip, int pal_base);
void VS920A_set_gfx_region(int numchip, int gfx_region);
void VS920A_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority);
void MB60553_init(int numchips);
void MB60553_set_pal_base(int numchip, int pal_base);
void MB60553_set_gfx_region(int numchip, int gfx_region);
void MB60553_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority);
tilemap_t* MB60553_get_tilemap(int numchip);
void mcu_init( );
}; };
#endif #endif

View File

@ -47,4 +47,6 @@ public:
DECLARE_PALETTE_INIT(josvolly); DECLARE_PALETTE_INIT(josvolly);
UINT32 screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(gsword_snd_interrupt); INTERRUPT_GEN_MEMBER(gsword_snd_interrupt);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
int gsword_coins_in(void);
}; };

View File

@ -42,4 +42,5 @@ public:
UINT32 screen_update_gunbustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gunbustr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(gunbustr_interrupt); INTERRUPT_GEN_MEMBER(gunbustr_interrupt);
TIMER_CALLBACK_MEMBER(gunbustr_interrupt5); TIMER_CALLBACK_MEMBER(gunbustr_interrupt5);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs);
}; };

View File

@ -41,4 +41,5 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_gunsmoke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gunsmoke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -56,4 +56,5 @@ public:
UINT32 screen_update_gyruss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_gyruss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(master_vblank_irq); INTERRUPT_GEN_MEMBER(master_vblank_irq);
INTERRUPT_GEN_MEMBER(slave_vblank_irq); INTERRUPT_GEN_MEMBER(slave_vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx );
}; };

View File

@ -17,15 +17,15 @@
***************************************************************************/ ***************************************************************************/
static void gaelco2_ROM16_split_gfx(running_machine &machine, const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2) void gaelco2_state::gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2)
{ {
int i; int i;
/* get a pointer to the source data */ /* get a pointer to the source data */
UINT8 *src = (UINT8 *)machine.root_device().memregion(src_reg)->base(); UINT8 *src = (UINT8 *)machine().root_device().memregion(src_reg)->base();
/* get a pointer to the destination data */ /* get a pointer to the destination data */
UINT8 *dst = (UINT8 *)machine.root_device().memregion(dst_reg)->base(); UINT8 *dst = (UINT8 *)machine().root_device().memregion(dst_reg)->base();
/* fill destination areas with the proper data */ /* fill destination areas with the proper data */
for (i = 0; i < length/2; i++){ for (i = 0; i < length/2; i++){
@ -62,16 +62,16 @@ DRIVER_INIT_MEMBER(gaelco2_state,alighunt)
*/ */
/* split ROM u48 */ /* split ROM u48 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
/* split ROM u47 */ /* split ROM u47 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
/* split ROM u50 */ /* split ROM u50 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
/* split ROM u49 */ /* split ROM u49 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0c00000, 0x0400000, 0x0a00000, 0x0e00000);
} }
@ -93,13 +93,13 @@ DRIVER_INIT_MEMBER(gaelco2_state,touchgo)
*/ */
/* split ROM ic65 */ /* split ROM ic65 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
/* split ROM ic66 */ /* split ROM ic66 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0200000, 0x0200000, 0x0600000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0200000, 0x0200000, 0x0600000);
/* split ROM ic67 */ /* split ROM ic67 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
} }
@ -121,13 +121,13 @@ DRIVER_INIT_MEMBER(gaelco2_state,snowboar)
*/ */
/* split ROM sb44 */ /* split ROM sb44 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0000000, 0x0400000, 0x0000000, 0x0400000);
/* split ROM sb45 */ /* split ROM sb45 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0400000, 0x0400000, 0x0200000, 0x0600000);
/* split ROM sb46 */ /* split ROM sb46 */
gaelco2_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000); gaelco2_ROM16_split_gfx("gfx2", "gfx1", 0x0800000, 0x0400000, 0x0800000, 0x0c00000);
} }
/*************************************************************************** /***************************************************************************

View File

@ -64,12 +64,11 @@ TIMER_DEVICE_CALLBACK_MEMBER(galaxold_state::galaxold_interrupt_timer)
} }
static void machine_reset_common(running_machine &machine, int line) void galaxold_state::machine_reset_common(int line)
{ {
galaxold_state *state = machine.driver_data<galaxold_state>(); ttl7474_device *ttl7474_9m_1 = machine().device<ttl7474_device>("7474_9m_1");
ttl7474_device *ttl7474_9m_1 = machine.device<ttl7474_device>("7474_9m_1"); ttl7474_device *ttl7474_9m_2 = machine().device<ttl7474_device>("7474_9m_2");
ttl7474_device *ttl7474_9m_2 = machine.device<ttl7474_device>("7474_9m_2"); m_irq_line = line;
state->m_irq_line = line;
/* initalize main CPU interrupt generator flip-flops */ /* initalize main CPU interrupt generator flip-flops */
ttl7474_9m_2->preset_w(1); ttl7474_9m_2->preset_w(1);
@ -80,23 +79,23 @@ static void machine_reset_common(running_machine &machine, int line)
ttl7474_9m_1->preset_w(0); ttl7474_9m_1->preset_w(0);
/* start a timer to generate interrupts */ /* start a timer to generate interrupts */
timer_device *int_timer = machine.device<timer_device>("int_timer"); timer_device *int_timer = machine().device<timer_device>("int_timer");
int_timer->adjust(machine.primary_screen->time_until_pos(0)); int_timer->adjust(machine().primary_screen->time_until_pos(0));
} }
MACHINE_RESET_MEMBER(galaxold_state,galaxold) MACHINE_RESET_MEMBER(galaxold_state,galaxold)
{ {
machine_reset_common(machine(), INPUT_LINE_NMI); machine_reset_common(INPUT_LINE_NMI);
} }
MACHINE_RESET_MEMBER(galaxold_state,devilfsg) MACHINE_RESET_MEMBER(galaxold_state,devilfsg)
{ {
machine_reset_common(machine(), 0); machine_reset_common(0);
} }
MACHINE_RESET_MEMBER(galaxold_state,hunchbkg) MACHINE_RESET_MEMBER(galaxold_state,hunchbkg)
{ {
machine_reset_common(machine(), 0); machine_reset_common(0);
machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(galaxold_state::hunchbkg_irq_callback),this)); machine().device("maincpu")->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(galaxold_state::hunchbkg_irq_callback),this));
} }
@ -281,7 +280,7 @@ DRIVER_INIT_MEMBER(galaxold_state,dingo)
} }
static UINT8 decode_mooncrst(UINT8 data,offs_t addr) UINT8 galaxold_state::decode_mooncrst(UINT8 data,offs_t addr)
{ {
UINT8 res; UINT8 res;

View File

@ -92,28 +92,26 @@ TILEMAP_MAPPER_MEMBER(bosco_state::fg_tilemap_scan )
} }
INLINE void get_tile_info_bosco(running_machine &machine,tile_data &tileinfo,int tile_index,int ram_offs) inline void bosco_state::get_tile_info_bosco(tile_data &tileinfo,int tile_index,int ram_offs)
{ {
bosco_state *state = machine.driver_data<bosco_state>(); UINT8 attr = m_videoram[ram_offs + tile_index + 0x800];
UINT8 attr = state->m_videoram[ram_offs + tile_index + 0x800];
tileinfo.category = (attr & 0x20) >> 5; tileinfo.category = (attr & 0x20) >> 5;
tileinfo.group = attr & 0x3f; tileinfo.group = attr & 0x3f;
SET_TILE_INFO( SET_TILE_INFO_MEMBER(
0, 0,
state->m_videoram[ram_offs + tile_index], m_videoram[ram_offs + tile_index],
attr & 0x3f, attr & 0x3f,
TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX); TILE_FLIPYX(attr >> 6) ^ TILE_FLIPX);
} }
TILE_GET_INFO_MEMBER(bosco_state::bg_get_tile_info ) TILE_GET_INFO_MEMBER(bosco_state::bg_get_tile_info )
{ {
get_tile_info_bosco(machine(),tileinfo,tile_index,0x400); get_tile_info_bosco(tileinfo,tile_index,0x400);
} }
TILE_GET_INFO_MEMBER(bosco_state::fg_get_tile_info ) TILE_GET_INFO_MEMBER(bosco_state::fg_get_tile_info )
{ {
get_tile_info_bosco(machine(),tileinfo,tile_index,0x000); get_tile_info_bosco(tileinfo,tile_index,0x000);
} }
@ -188,14 +186,13 @@ WRITE8_HANDLER( bosco_starclr_w )
***************************************************************************/ ***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void bosco_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bosco_state *state = machine.driver_data<bosco_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram; UINT8 *spriteram_2 = m_spriteram2;
UINT8 *spriteram_2 = state->m_spriteram2;
int offs; int offs;
for (offs = 0;offs < state->m_spriteram_size;offs += 2) for (offs = 0;offs < m_spriteram_size;offs += 2)
{ {
int sx = spriteram[offs + 1] - 1; int sx = spriteram[offs + 1] - 1;
int sy = 240 - spriteram_2[offs]; int sy = 240 - spriteram_2[offs];
@ -203,40 +200,39 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
int flipy = spriteram[offs] & 2; int flipy = spriteram[offs] & 2;
int color = spriteram_2[offs + 1] & 0x3f; int color = spriteram_2[offs + 1] & 0x3f;
if (state->flip_screen()) if (flip_screen())
{ {
sx += 128-2; sx += 128-2;
sy += 8; sy += 8;
} }
drawgfx_transmask(bitmap,cliprect,machine.gfx[1], drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
(spriteram[offs] & 0xfc) >> 2, (spriteram[offs] & 0xfc) >> 2,
color, color,
flipx,flipy, flipx,flipy,
sx,sy, sx,sy,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x0f)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x0f));
} }
} }
static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void bosco_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bosco_state *state = machine.driver_data<bosco_state>();
int offs; int offs;
for (offs = 4; offs < 0x10;offs++) for (offs = 4; offs < 0x10;offs++)
{ {
int x = state->m_bosco_radarx[offs] + ((~state->m_bosco_radarattr[offs] & 0x01) << 8); int x = m_bosco_radarx[offs] + ((~m_bosco_radarattr[offs] & 0x01) << 8);
int y = 253 - state->m_bosco_radary[offs]; int y = 253 - m_bosco_radary[offs];
if (state->flip_screen()) if (flip_screen())
{ {
x += 96-2; x += 96-2;
y += 8; y += 8;
} }
drawgfx_transmask(bitmap,cliprect,machine.gfx[2], drawgfx_transmask(bitmap,cliprect,machine().gfx[2],
((state->m_bosco_radarattr[offs] & 0x0e) >> 1) ^ 0x07, ((m_bosco_radarattr[offs] & 0x0e) >> 1) ^ 0x07,
0, 0,
0,0, 0,0,
x,y,0xf0); x,y,0xf0);
@ -244,18 +240,16 @@ static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const r
} }
static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip) void bosco_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip)
{ {
bosco_state *state = machine.driver_data<bosco_state>();
if (1) if (1)
{ {
int star_cntr; int star_cntr;
int set_a, set_b; int set_a, set_b;
/* two sets of stars controlled by these bits */ /* two sets of stars controlled by these bits */
set_a = (state->m_bosco_starblink[0] & 1); set_a = (m_bosco_starblink[0] & 1);
set_b = (state->m_bosco_starblink[1] & 1) | 2; set_b = (m_bosco_starblink[1] & 1) | 2;
for (star_cntr = 0;star_cntr < MAX_STARS;star_cntr++) for (star_cntr = 0;star_cntr < MAX_STARS;star_cntr++)
{ {
@ -263,8 +257,8 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec
if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) ) if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) )
{ {
x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256; x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256;
y = (star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256; y = (star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
/* dont draw the stars that are off the screen */ /* dont draw the stars that are off the screen */
if ( x < 224 ) if ( x < 224 )
@ -298,18 +292,18 @@ UINT32 bosco_state::screen_update_bosco(screen_device &screen, bitmap_ind16 &bit
} }
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);
draw_stars(machine(),bitmap,cliprect,flip_screen()); draw_stars(bitmap,cliprect,flip_screen());
m_bg_tilemap->draw(bitmap, bg_clip, 0,0); m_bg_tilemap->draw(bitmap, bg_clip, 0,0);
m_fg_tilemap->draw(bitmap, fg_clip, 0,0); m_fg_tilemap->draw(bitmap, fg_clip, 0,0);
draw_sprites(machine(), bitmap,cliprect); draw_sprites(bitmap,cliprect);
/* draw the high priority characters */ /* draw the high priority characters */
m_bg_tilemap->draw(bitmap, bg_clip, 1,0); m_bg_tilemap->draw(bitmap, bg_clip, 1,0);
m_fg_tilemap->draw(bitmap, fg_clip, 1,0); m_fg_tilemap->draw(bitmap, fg_clip, 1,0);
draw_bullets(machine(), bitmap,cliprect); draw_bullets(bitmap,cliprect);
return 0; return 0;
} }

View File

@ -237,19 +237,18 @@ WRITE8_HANDLER( digdug_PORT_w )
***************************************************************************/ ***************************************************************************/
static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void digdug_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
digdug_state *state = machine.driver_data<digdug_state>(); UINT8 *spriteram = m_digdug_objram + 0x380;
UINT8 *spriteram = state->m_digdug_objram + 0x380; UINT8 *spriteram_2 = m_digdug_posram + 0x380;
UINT8 *spriteram_2 = state->m_digdug_posram + 0x380; UINT8 *spriteram_3 = m_digdug_flpram + 0x380;
UINT8 *spriteram_3 = state->m_digdug_flpram + 0x380;
int offs; int offs;
// mask upper and lower columns // mask upper and lower columns
rectangle visarea = cliprect; rectangle visarea = cliprect;
visarea.min_x = 2*8; visarea.min_x = 2*8;
visarea.max_x = 34*8-1; visarea.max_x = 34*8-1;
if (state->flip_screen()) if (flip_screen())
{ {
visarea.min_x += 12*8; visarea.min_x += 12*8;
visarea.max_x += 12*8; visarea.max_x += 12*8;
@ -277,7 +276,7 @@ static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap, const r
sy -= 16 * size; sy -= 16 * size;
sy = (sy & 0xff) - 32; // fix wraparound sy = (sy & 0xff) - 32; // fix wraparound
if (state->flip_screen()) if (flip_screen())
{ {
flipx ^= 1; flipx ^= 1;
flipy ^= 1; flipy ^= 1;
@ -289,14 +288,14 @@ static void draw_sprites(running_machine& machine, bitmap_ind16 &bitmap, const r
{ {
for (x = 0;x <= size;x++) for (x = 0;x <= size;x++)
{ {
UINT32 transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x1f); UINT32 transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x1f);
drawgfx_transmask(bitmap,visarea,machine.gfx[1], drawgfx_transmask(bitmap,visarea,machine().gfx[1],
sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)], sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)],
color, color,
flipx,flipy, flipx,flipy,
((sx + 16*x) & 0xff), sy + 16*y,transmask); ((sx + 16*x) & 0xff), sy + 16*y,transmask);
/* wraparound */ /* wraparound */
drawgfx_transmask(bitmap,visarea,machine.gfx[1], drawgfx_transmask(bitmap,visarea,machine().gfx[1],
sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)], sprite + gfx_offs[y ^ (size * flipy)][x ^ (size * flipx)],
color, color,
flipx,flipy, flipx,flipy,
@ -311,6 +310,6 @@ UINT32 digdug_state::screen_update_digdug(screen_device &screen, bitmap_ind16 &b
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_bg_tilemap->draw(bitmap, cliprect, 0,0);
m_fg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(),bitmap,cliprect); draw_sprites(bitmap,cliprect);
return 0; return 0;
} }

View File

@ -352,7 +352,7 @@ VIDEO_START_MEMBER(fastfred_state,imago)
m_fg_tilemap->set_transparent_pen(0); m_fg_tilemap->set_transparent_pen(0);
/* the game has a galaxian starfield */ /* the game has a galaxian starfield */
galaxold_init_stars(machine(), 256); galaxold_init_stars(256);
m_stars_on = 1; m_stars_on = 1;
/* web colors */ /* web colors */
@ -363,7 +363,7 @@ VIDEO_START_MEMBER(fastfred_state,imago)
UINT32 fastfred_state::screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 fastfred_state::screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_web_tilemap->draw(bitmap, cliprect, 0,0); m_web_tilemap->draw(bitmap, cliprect, 0,0);
galaxold_draw_stars(machine(), bitmap, cliprect); galaxold_draw_stars(bitmap, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_bg_tilemap->draw(bitmap, cliprect, 0,0);
draw_sprites(bitmap, cliprect); draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,0);

View File

@ -116,23 +116,22 @@ VIDEO_START_MEMBER(gaelco_state,maniacsq)
3 | xxxxxxxx xxxxxx-- | sprite code 3 | xxxxxxxx xxxxxx-- | sprite code
*/ */
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gaelco_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
gaelco_state *state = machine.driver_data<gaelco_state>();
int i, x, y, ex, ey; int i, x, y, ex, ey;
gfx_element *gfx = machine.gfx[0]; gfx_element *gfx = machine().gfx[0];
static const int x_offset[2] = {0x0,0x2}; static const int x_offset[2] = {0x0,0x2};
static const int y_offset[2] = {0x0,0x1}; static const int y_offset[2] = {0x0,0x1};
for (i = 0x800 - 4 - 1; i >= 3; i -= 4) for (i = 0x800 - 4 - 1; i >= 3; i -= 4)
{ {
int sx = state->m_spriteram[i + 2] & 0x01ff; int sx = m_spriteram[i + 2] & 0x01ff;
int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff; int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff;
int number = state->m_spriteram[i + 3]; int number = m_spriteram[i + 3];
int color = (state->m_spriteram[i + 2] & 0x7e00) >> 9; int color = (m_spriteram[i + 2] & 0x7e00) >> 9;
int attr = (state->m_spriteram[i] & 0xfe00) >> 9; int attr = (m_spriteram[i] & 0xfe00) >> 9;
int priority = (state->m_spriteram[i] & 0x3000) >> 12; int priority = (m_spriteram[i] & 0x3000) >> 12;
int xflip = attr & 0x20; int xflip = attr & 0x20;
int yflip = attr & 0x40; int yflip = attr & 0x40;
@ -170,7 +169,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
pdrawgfx_transpen(bitmap,cliprect,gfx,number + x_offset[ex] + y_offset[ey], pdrawgfx_transpen(bitmap,cliprect,gfx,number + x_offset[ex] + y_offset[ey],
color,xflip,yflip, color,xflip,yflip,
sx-0x0f+x*8,sy+y*8, sx-0x0f+x*8,sy+y*8,
machine.priority_bitmap,pri_mask,0); machine().priority_bitmap,pri_mask,0);
} }
} }
} }
@ -205,7 +204,7 @@ UINT32 gaelco_state::screen_update_maniacsq(screen_device &screen, bitmap_ind16
m_tilemap[1]->draw(bitmap, cliprect, 0, 4); m_tilemap[1]->draw(bitmap, cliprect, 0, 4);
m_tilemap[0]->draw(bitmap, cliprect, 0, 4); m_tilemap[0]->draw(bitmap, cliprect, 0, 4);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }
@ -244,6 +243,6 @@ UINT32 gaelco_state::screen_update_bigkarnk(screen_device &screen, bitmap_ind16
m_tilemap[1]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8); m_tilemap[1]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8);
m_tilemap[0]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8); m_tilemap[0]->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0 | 0, 8);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -332,19 +332,18 @@ VIDEO_START_MEMBER(gaelco2_state,gaelco2_dual)
***************************************************************************/ ***************************************************************************/
static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs) void gaelco2_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int mask, int xoffs)
{ {
gaelco2_state *state = screen.machine().driver_data<gaelco2_state>(); UINT16 *buffered_spriteram16 = m_spriteram->buffer();
UINT16 *buffered_spriteram16 = state->m_spriteram->buffer();
int j, x, y, ex, ey, px, py; int j, x, y, ex, ey, px, py;
gfx_element *gfx = screen.machine().gfx[0]; gfx_element *gfx = screen.machine().gfx[0];
/* get sprite ram start and end offsets */ /* get sprite ram start and end offsets */
int start_offset = (state->m_vregs[1] & 0x10)*0x100; int start_offset = (m_vregs[1] & 0x10)*0x100;
int end_offset = start_offset + 0x1000; int end_offset = start_offset + 0x1000;
/* sprite offset is based on the visible area */ /* sprite offset is based on the visible area */
int spr_x_adjust = (screen.visible_area().max_x - 320 + 1) - (511 - 320 - 1) - ((state->m_vregs[0] >> 4) & 0x01) + xoffs; int spr_x_adjust = (screen.visible_area().max_x - 320 + 1) - (511 - 320 - 1) - ((m_vregs[0] >> 4) & 0x01) + xoffs;
for (j = start_offset; j < end_offset; j += 8){ for (j = start_offset; j < end_offset; j += 8){
int data = buffered_spriteram16[(j/2) + 0]; int data = buffered_spriteram16[(j/2) + 0];
@ -361,7 +360,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
int xsize = ((data3 >> 12) & 0x0f) + 1; int xsize = ((data3 >> 12) & 0x0f) + 1;
int ysize = ((data2 >> 12) & 0x0f) + 1; int ysize = ((data2 >> 12) & 0x0f) + 1;
if (state->m_dual_monitor && ((data & 0x8000) != mask)) continue; if (m_dual_monitor && ((data & 0x8000) != mask)) continue;
/* if it's enabled, draw it */ /* if it's enabled, draw it */
if ((data2 & 0x0200) != 0){ if ((data2 & 0x0200) != 0){
@ -371,7 +370,7 @@ static void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rect
int data5 = buffered_spriteram16[((data4/2) + (y*xsize + x)) & 0x7fff]; int data5 = buffered_spriteram16[((data4/2) + (y*xsize + x)) & 0x7fff];
int number = ((data & 0x1ff) << 10) + (data5 & 0x0fff); int number = ((data & 0x1ff) << 10) + (data5 & 0x0fff);
int color = ((data >> 9) & 0x7f) + ((data5 >> 12) & 0x0f); int color = ((data >> 9) & 0x7f) + ((data5 >> 12) & 0x0f);
int color_effect = state->m_dual_monitor ? ((color & 0x3f) == 0x3f) : (color == 0x7f); int color_effect = m_dual_monitor ? ((color & 0x3f) == 0x3f) : (color == 0x7f);
ex = xflip ? (xsize - 1 - x) : x; ex = xflip ? (xsize - 1 - x) : x;
ey = yflip ? (ysize - 1 - y) : y; ey = yflip ? (ysize - 1 - y) : y;
@ -458,31 +457,30 @@ UINT32 gaelco2_state::screen_update_gaelco2(screen_device &screen, bitmap_ind16
return 0; return 0;
} }
static UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index) UINT32 gaelco2_state::dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index)
{ {
gaelco2_state *state = screen.machine().driver_data<gaelco2_state>();
int i; int i;
/* read scroll values */ /* read scroll values */
int scroll0x = state->m_videoram[0x2802/2] + 0x14; int scroll0x = m_videoram[0x2802/2] + 0x14;
int scroll1x = state->m_videoram[0x2806/2] + 0x10; int scroll1x = m_videoram[0x2806/2] + 0x10;
int scroll0y = state->m_videoram[0x2800/2] + 0x01; int scroll0y = m_videoram[0x2800/2] + 0x01;
int scroll1y = state->m_videoram[0x2804/2] + 0x01; int scroll1y = m_videoram[0x2804/2] + 0x01;
/* set y scroll registers */ /* set y scroll registers */
state->m_pant[0]->set_scrolly(0, scroll0y & 0x1ff); m_pant[0]->set_scrolly(0, scroll0y & 0x1ff);
state->m_pant[1]->set_scrolly(0, scroll1y & 0x1ff); m_pant[1]->set_scrolly(0, scroll1y & 0x1ff);
/* set x linescroll registers */ /* set x linescroll registers */
for (i = 0; i < 512; i++){ for (i = 0; i < 512; i++){
state->m_pant[0]->set_scrollx(i & 0x1ff, (state->m_vregs[0] & 0x8000) ? (state->m_videoram[(0x2000/2) + i] + 0x14) & 0x3ff : scroll0x & 0x3ff); m_pant[0]->set_scrollx(i & 0x1ff, (m_vregs[0] & 0x8000) ? (m_videoram[(0x2000/2) + i] + 0x14) & 0x3ff : scroll0x & 0x3ff);
state->m_pant[1]->set_scrollx(i & 0x1ff, (state->m_vregs[1] & 0x8000) ? (state->m_videoram[(0x2400/2) + i] + 0x10) & 0x3ff : scroll1x & 0x3ff); m_pant[1]->set_scrollx(i & 0x1ff, (m_vregs[1] & 0x8000) ? (m_videoram[(0x2400/2) + i] + 0x10) & 0x3ff : scroll1x & 0x3ff);
} }
/* draw screen */ /* draw screen */
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
state->m_pant[index]->draw(bitmap, cliprect, 0, 0); m_pant[index]->draw(bitmap, cliprect, 0, 0);
draw_sprites(screen,bitmap,cliprect, 0x8000 * index, 0); draw_sprites(screen,bitmap,cliprect, 0x8000 * index, 0);
return 0; return 0;

View File

@ -346,16 +346,16 @@ void gaelco3d_renderer::render_alphablend(INT32 scanline, const extent_t &extent
* *
*************************************/ *************************************/
void gaelco3d_render(screen_device &screen) void gaelco3d_state::gaelco3d_render(screen_device &screen)
{ {
gaelco3d_state *state = screen.machine().driver_data<gaelco3d_state>(); gaelco3d_state *state = screen.machine().driver_data<gaelco3d_state>();
/* wait for any queued stuff to complete */ /* wait for any queued stuff to complete */
state->m_poly->wait("Time to render"); m_poly->wait("Time to render");
#if DISPLAY_STATS #if DISPLAY_STATS
{ {
int scan = screen.vpos(); int scan = screen.vpos();
popmessage("Polys = %4d Timeleft = %3d", state->m_poly->polygons(), (state->m_lastscan < scan) ? (scan - state->m_lastscan) : (scan + (state->m_lastscan - screen.visible_area().max_y))); popmessage("Polys = %4d Timeleft = %3d", m_poly->polygons(), (m_lastscan < scan) ? (scan - m_lastscan) : (scan + (m_lastscan - screen.visible_area().max_y)));
} }
#endif #endif

View File

@ -272,12 +272,11 @@ WRITE16_MEMBER(gaiden_state::gaiden_videoram_w)
to blend into the final 32-bit rgb bitmaps, this is currently broken (due to zsolt's core to blend into the final 32-bit rgb bitmaps, this is currently broken (due to zsolt's core
changes?) it appears that the sprite drawing is no longer putting the correct raw data changes?) it appears that the sprite drawing is no longer putting the correct raw data
in the bitmaps? */ in the bitmaps? */
static void blendbitmaps(running_machine &machine, void gaiden_state::blendbitmaps(bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3,
bitmap_rgb32 &dest,bitmap_ind16 &src1,bitmap_ind16 &src2,bitmap_ind16 &src3,
int sx,int sy,const rectangle &cliprect) int sx,int sy,const rectangle &cliprect)
{ {
int y,x; int y,x;
const pen_t *paldata = machine.pens; const pen_t *paldata = machine().pens;
for (y = cliprect.min_y; y <= cliprect.max_y; y++) for (y = cliprect.min_y; y <= cliprect.max_y; y++)
{ {
@ -330,10 +329,9 @@ static void blendbitmaps(running_machine &machine,
* |---------x------- | x position (high bit) * |---------x------- | x position (high bit)
*/ */
static void drgnbowl_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void gaiden_state::drgnbowl_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
gaiden_state *state = machine.driver_data<gaiden_state>(); UINT16 *spriteram = m_spriteram;
UINT16 *spriteram = state->m_spriteram;
int i, code, color, x, y, flipx, flipy, priority_mask; int i, code, color, x, y, flipx, flipy, priority_mask;
for( i = 0; i < 0x800/2; i += 4 ) for( i = 0; i < 0x800/2; i += 4 )
@ -355,18 +353,18 @@ static void drgnbowl_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap
else else
priority_mask = 0; priority_mask = 0;
pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3], pdrawgfx_transpen_raw(bitmap,cliprect,machine().gfx[3],
code, code,
machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(), machine().gfx[3]->colorbase() + color * machine().gfx[3]->granularity(),
flipx,flipy,x,y, flipx,flipy,x,y,
machine.priority_bitmap, priority_mask,15); machine().priority_bitmap, priority_mask,15);
/* wrap x*/ /* wrap x*/
pdrawgfx_transpen_raw(bitmap,cliprect,machine.gfx[3], pdrawgfx_transpen_raw(bitmap,cliprect,machine().gfx[3],
code, code,
machine.gfx[3]->colorbase() + color * machine.gfx[3]->granularity(), machine().gfx[3]->colorbase() + color * machine().gfx[3]->granularity(),
flipx,flipy,x-512,y, flipx,flipy,x-512,y,
machine.priority_bitmap, priority_mask,15); machine().priority_bitmap, priority_mask,15);
} }
} }
@ -391,7 +389,7 @@ UINT32 gaiden_state::screen_update_gaiden(screen_device &screen, bitmap_rgb32 &b
gaiden_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen()); gaiden_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen());
/* mix & blend the tilemaps and sprites into a 32-bit bitmap */ /* mix & blend the tilemaps and sprites into a 32-bit bitmap */
blendbitmaps(machine(), bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect); blendbitmaps(bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect);
return 0; return 0;
} }
@ -416,7 +414,7 @@ UINT32 gaiden_state::screen_update_raiga(screen_device &screen, bitmap_rgb32 &bi
raiga_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen()); raiga_draw_sprites(machine(), m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, cliprect, m_spriteram, m_sprite_sizey, m_spr_offset_y, flip_screen());
/* mix & blend the tilemaps and sprites into a 32-bit bitmap */ /* mix & blend the tilemaps and sprites into a 32-bit bitmap */
blendbitmaps(machine(), bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect); blendbitmaps(bitmap, m_tile_bitmap_bg, m_tile_bitmap_fg, m_sprite_bitmap, 0, 0, cliprect);
return 0; return 0;
} }
@ -427,6 +425,6 @@ UINT32 gaiden_state::screen_update_drgnbowl(screen_device &screen, bitmap_ind16
m_background->draw(bitmap, cliprect, 0, 1); m_background->draw(bitmap, cliprect, 0, 1);
m_foreground->draw(bitmap, cliprect, 0, 2); m_foreground->draw(bitmap, cliprect, 0, 2);
m_text_layer->draw(bitmap, cliprect, 0, 4); m_text_layer->draw(bitmap, cliprect, 0, 4);
drgnbowl_draw_sprites(machine(), bitmap, cliprect); drgnbowl_draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -470,13 +470,12 @@ WRITE8_MEMBER(galaga_state::gatsbee_bank_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void galaga_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
galaga_state *state = machine.driver_data<galaga_state>();
UINT8 *spriteram = state->m_galaga_ram1 + 0x380; UINT8 *spriteram = m_galaga_ram1 + 0x380;
UINT8 *spriteram_2 = state->m_galaga_ram2 + 0x380; UINT8 *spriteram_2 = m_galaga_ram2 + 0x380;
UINT8 *spriteram_3 = state->m_galaga_ram3 + 0x380; UINT8 *spriteram_3 = m_galaga_ram3 + 0x380;
int offs; int offs;
@ -500,7 +499,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
sy -= 16 * sizey; sy -= 16 * sizey;
sy = (sy & 0xff) - 32; // fix wraparound sy = (sy & 0xff) - 32; // fix wraparound
if (state->flip_screen()) if (flip_screen())
{ {
flipx ^= 1; flipx ^= 1;
flipy ^= 1; flipy ^= 1;
@ -512,35 +511,34 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
{ {
for (x = 0;x <= sizex;x++) for (x = 0;x <= sizex;x++)
{ {
drawgfx_transmask(bitmap,cliprect,machine.gfx[1], drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
color, color,
flipx,flipy, flipx,flipy,
sx + 16*x, sy + 16*y, sx + 16*x, sy + 16*y,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0x0f)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0x0f));
} }
} }
} }
} }
static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void galaga_state::draw_stars(bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
galaga_state *state = machine.driver_data<galaga_state>();
/* draw the stars */ /* draw the stars */
/* $a005 controls the stars ON/OFF */ /* $a005 controls the stars ON/OFF */
if ( (state->m_galaga_starcontrol[5] & 1) == 1 ) if ( (m_galaga_starcontrol[5] & 1) == 1 )
{ {
int y_align = 112; /* 112 is a tweak to get alignment about perfect */ int y_align = 112; /* 112 is a tweak to get alignment about perfect */
int x_align = state->flip_screen() ? 112 : 16; int x_align = flip_screen() ? 112 : 16;
int star_cntr; int star_cntr;
int set_a, set_b; int set_a, set_b;
/* two sets of stars controlled by these bits */ /* two sets of stars controlled by these bits */
set_a = (state->m_galaga_starcontrol[3] & 1); set_a = (m_galaga_starcontrol[3] & 1);
set_b = (state->m_galaga_starcontrol[4] & 1) | 2; set_b = (m_galaga_starcontrol[4] & 1) | 2;
for (star_cntr = 0;star_cntr < MAX_STARS ;star_cntr++) for (star_cntr = 0;star_cntr < MAX_STARS ;star_cntr++)
{ {
@ -548,8 +546,8 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec
if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) ) if ( (set_a == star_seed_tab[star_cntr].set) || ( set_b == star_seed_tab[star_cntr].set) )
{ {
x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256 + x_align; x = (star_seed_tab[star_cntr].x + m_stars_scrollx) % 256 + x_align;
y = (y_align + star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256; y = (y_align + star_seed_tab[star_cntr].y + m_stars_scrolly) % 256;
if (cliprect.contains(x, y)) if (cliprect.contains(x, y))
bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col; bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col;
@ -562,8 +560,8 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec
UINT32 galaga_state::screen_update_galaga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 galaga_state::screen_update_galaga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);
draw_stars(machine(),bitmap,cliprect); draw_stars(bitmap,cliprect);
draw_sprites(machine(),bitmap,cliprect); draw_sprites(bitmap,cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,0);
return 0; return 0;
} }

View File

@ -82,11 +82,10 @@ Heavy use is made of sprite zooming.
********************************************************/ ********************************************************/
static void draw_sprites_pre(running_machine &machine, int x_offs, int y_offs) void galastrm_state::draw_sprites_pre(int x_offs, int y_offs)
{ {
galastrm_state *state = machine.driver_data<galastrm_state>(); UINT32 *spriteram32 = m_spriteram;
UINT32 *spriteram32 = state->m_spriteram; UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
int offs, data, tilenum, color, flipx, flipy; int offs, data, tilenum, color, flipx, flipy;
int x, y, priority, dblsize, curx, cury; int x, y, priority, dblsize, curx, cury;
int sprites_flipscreen = 0; int sprites_flipscreen = 0;
@ -96,9 +95,9 @@ static void draw_sprites_pre(running_machine &machine, int x_offs, int y_offs)
/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
while processing sprite ram and then draw them all at the end */ while processing sprite ram and then draw them all at the end */
state->m_sprite_ptr_pre = state->m_spritelist; m_sprite_ptr_pre = m_spritelist;
for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{ {
data = spriteram32[offs+0]; data = spriteram32[offs+0];
flipx = (data & 0x00800000) >> 23; flipx = (data & 0x00800000) >> 23;
@ -171,43 +170,42 @@ static void draw_sprites_pre(running_machine &machine, int x_offs, int y_offs)
flipy = !flipy; flipy = !flipy;
} }
state->m_sprite_ptr_pre->gfx = 0; m_sprite_ptr_pre->gfx = 0;
state->m_sprite_ptr_pre->code = code; m_sprite_ptr_pre->code = code;
state->m_sprite_ptr_pre->color = color; m_sprite_ptr_pre->color = color;
state->m_sprite_ptr_pre->flipx = !flipx; m_sprite_ptr_pre->flipx = !flipx;
state->m_sprite_ptr_pre->flipy = flipy; m_sprite_ptr_pre->flipy = flipy;
state->m_sprite_ptr_pre->x = curx; m_sprite_ptr_pre->x = curx;
state->m_sprite_ptr_pre->y = cury; m_sprite_ptr_pre->y = cury;
state->m_sprite_ptr_pre->zoomx = zx << 12; m_sprite_ptr_pre->zoomx = zx << 12;
state->m_sprite_ptr_pre->zoomy = zy << 12; m_sprite_ptr_pre->zoomy = zy << 12;
state->m_sprite_ptr_pre->primask = priority; m_sprite_ptr_pre->primask = priority;
state->m_sprite_ptr_pre++; m_sprite_ptr_pre++;
} }
if (bad_chunks) if (bad_chunks)
logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks); logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
} }
} }
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority) void galastrm_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const int *primasks, int priority)
{ {
galastrm_state *state = machine.driver_data<galastrm_state>(); struct tempsprite *sprite_ptr = m_sprite_ptr_pre;
struct tempsprite *sprite_ptr = state->m_sprite_ptr_pre;
while (sprite_ptr != state->m_spritelist) while (sprite_ptr != m_spritelist)
{ {
sprite_ptr--; sprite_ptr--;
if ((priority != 0 && sprite_ptr->primask != 0) || if ((priority != 0 && sprite_ptr->primask != 0) ||
(priority == 0 && sprite_ptr->primask == 0)) (priority == 0 && sprite_ptr->primask == 0))
{ {
pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
sprite_ptr->code, sprite_ptr->code,
sprite_ptr->color, sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->flipx,sprite_ptr->flipy,
sprite_ptr->x,sprite_ptr->y, sprite_ptr->x,sprite_ptr->y,
sprite_ptr->zoomx,sprite_ptr->zoomy, sprite_ptr->zoomx,sprite_ptr->zoomy,
machine.priority_bitmap,primasks[sprite_ptr->primask],0); machine().priority_bitmap,primasks[sprite_ptr->primask],0);
} }
} }
} }
@ -238,18 +236,17 @@ static void tc0610_draw_scanline(void *dest, INT32 scanline, const poly_extent *
} }
} }
static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip) void galastrm_state::tc0610_rotate_draw(bitmap_ind16 &bitmap, bitmap_ind16 &srcbitmap, const rectangle &clip)
{ {
galastrm_state *state = machine.driver_data<galastrm_state>(); poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(m_poly);
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly);
poly_draw_scanline_func callback; poly_draw_scanline_func callback;
poly_vertex vert[4]; poly_vertex vert[4];
int rsx = state->m_tc0610_ctrl_reg[1][0]; int rsx = m_tc0610_ctrl_reg[1][0];
int rsy = state->m_tc0610_ctrl_reg[1][1]; int rsy = m_tc0610_ctrl_reg[1][1];
const int rzx = state->m_tc0610_ctrl_reg[1][2]; const int rzx = m_tc0610_ctrl_reg[1][2];
const int rzy = state->m_tc0610_ctrl_reg[1][3]; const int rzy = m_tc0610_ctrl_reg[1][3];
const int ryx = state->m_tc0610_ctrl_reg[1][5]; const int ryx = m_tc0610_ctrl_reg[1][5];
const int ryy = state->m_tc0610_ctrl_reg[1][4]; const int ryy = m_tc0610_ctrl_reg[1][4];
const int lx = srcbitmap.width(); const int lx = srcbitmap.width();
const int ly = srcbitmap.height(); const int ly = srcbitmap.height();
@ -283,48 +280,48 @@ static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, b
zcs = ((float)pxx/4096.0) / (float)(lx / 2); zcs = ((float)pxx/4096.0) / (float)(lx / 2);
if ((rsx == -240 && rsy == 1072) || !state->m_tc0610_ctrl_reg[1][7]) if ((rsx == -240 && rsy == 1072) || !m_tc0610_ctrl_reg[1][7])
{ {
state->m_rsxoffs = 0; m_rsxoffs = 0;
state->m_rsyoffs = 0; m_rsyoffs = 0;
} }
else else
{ {
if (rsx > state->m_rsxb && state->m_rsxb < 0 && rsx-state->m_rsxb > 0x8000) if (rsx > m_rsxb && m_rsxb < 0 && rsx-m_rsxb > 0x8000)
{ {
if (state->m_rsxoffs == 0) if (m_rsxoffs == 0)
state->m_rsxoffs = -0x10000; m_rsxoffs = -0x10000;
else else
state->m_rsxoffs = 0; m_rsxoffs = 0;
} }
if (rsx < state->m_rsxb && state->m_rsxb > 0 && state->m_rsxb-rsx > 0x8000) if (rsx < m_rsxb && m_rsxb > 0 && m_rsxb-rsx > 0x8000)
{ {
if (state->m_rsxoffs == 0) if (m_rsxoffs == 0)
state->m_rsxoffs = 0x10000-1; m_rsxoffs = 0x10000-1;
else else
state->m_rsxoffs = 0; m_rsxoffs = 0;
} }
if (rsy > state->m_rsyb && state->m_rsyb < 0 && rsy-state->m_rsyb > 0x8000) if (rsy > m_rsyb && m_rsyb < 0 && rsy-m_rsyb > 0x8000)
{ {
if (state->m_rsyoffs == 0) if (m_rsyoffs == 0)
state->m_rsyoffs = -0x10000; m_rsyoffs = -0x10000;
else else
state->m_rsyoffs = 0; m_rsyoffs = 0;
} }
if (rsy < state->m_rsyb && state->m_rsyb > 0 && state->m_rsyb-rsy > 0x8000) if (rsy < m_rsyb && m_rsyb > 0 && m_rsyb-rsy > 0x8000)
{ {
if (state->m_rsyoffs == 0) if (m_rsyoffs == 0)
state->m_rsyoffs = 0x10000-1; m_rsyoffs = 0x10000-1;
else else
state->m_rsyoffs = 0; m_rsyoffs = 0;
} }
} }
state->m_rsxb = rsx; m_rsxb = rsx;
state->m_rsyb = rsy; m_rsyb = rsy;
if (state->m_rsxoffs) rsx += state->m_rsxoffs; if (m_rsxoffs) rsx += m_rsxoffs;
if (state->m_rsyoffs) rsy += state->m_rsyoffs; if (m_rsyoffs) rsy += m_rsyoffs;
if (rsx < -0x14000 || rsx >= 0x14000) state->m_rsxoffs = 0; if (rsx < -0x14000 || rsx >= 0x14000) m_rsxoffs = 0;
if (rsy < -0x14000 || rsy >= 0x14000) state->m_rsyoffs = 0; if (rsy < -0x14000 || rsy >= 0x14000) m_rsyoffs = 0;
pxx = 0; pxx = 0;
@ -338,7 +335,7 @@ static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, b
//ysn = 0.0; //ysn = 0.0;
//ycs = 0.0; //ycs = 0.0;
if (state->m_tc0610_ctrl_reg[1][7]) if (m_tc0610_ctrl_reg[1][7])
{ {
if (ryx != 0 || ryy != 0) if (ryx != 0 || ryy != 0)
{ {
@ -423,7 +420,7 @@ static void tc0610_rotate_draw(running_machine &machine, bitmap_ind16 &bitmap, b
extra->texbase = &srcbitmap; extra->texbase = &srcbitmap;
callback = tc0610_draw_scanline; callback = tc0610_draw_scanline;
poly_render_quad(state->m_poly, &bitmap, clip, callback, 2, &vert[0], &vert[1], &vert[2], &vert[3]); poly_render_quad(m_poly, &bitmap, clip, callback, 2, &vert[0], &vert[1], &vert[2], &vert[3]);
} }
/************************************************************** /**************************************************************
@ -542,15 +539,15 @@ UINT32 galastrm_state::screen_update_galastrm(screen_device &screen, bitmap_ind1
} }
} }
draw_sprites_pre(machine(), 42-X_OFFSET, -571+Y_OFFSET); draw_sprites_pre(42-X_OFFSET, -571+Y_OFFSET);
draw_sprites(machine(),m_tmpbitmaps,clip,primasks,1); draw_sprites(m_tmpbitmaps,clip,primasks,1);
copybitmap_trans(bitmap,m_polybitmap,0,0, 0,0,cliprect,0); copybitmap_trans(bitmap,m_polybitmap,0,0, 0,0,cliprect,0);
m_polybitmap.fill(0, clip); m_polybitmap.fill(0, clip);
tc0610_rotate_draw(machine(),m_polybitmap,m_tmpbitmaps,cliprect); tc0610_rotate_draw(m_polybitmap,m_tmpbitmaps,cliprect);
priority_bitmap.fill(0, cliprect); priority_bitmap.fill(0, cliprect);
draw_sprites(machine(),bitmap,cliprect,primasks,0); draw_sprites(bitmap,cliprect,primasks,0);
tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0);
tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0);

View File

@ -227,26 +227,6 @@ H=B0: 0C,0C,0D,0D,0E,0E,0F,0F 0C,0C,2D,2D,0E,0E,2F,2F
#define RGB_MAXIMUM 224 #define RGB_MAXIMUM 224
/*************************************
*
* Function prototypes
*
*************************************/
static void state_save_register(running_machine &machine);
static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase);
static void stars_init(running_machine &machine);
static void stars_update_origin(running_machine &machine);
static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask);
static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base);
/************************************* /*************************************
* *
* Palette setup * Palette setup
@ -417,29 +397,28 @@ void galaxian_state::video_start()
m_background_green = 0; m_background_green = 0;
/* initialize stars */ /* initialize stars */
stars_init(machine()); stars_init();
/* register for save states */ /* register for save states */
state_save_register(machine()); state_save_register();
} }
static void state_save_register(running_machine &machine) void galaxian_state::state_save_register()
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); state_save_register_global(machine(), m_flipscreen_x);
state_save_register_global(machine, state->m_flipscreen_x); state_save_register_global(machine(), m_flipscreen_y);
state_save_register_global(machine, state->m_flipscreen_y); state_save_register_global(machine(), m_background_enable);
state_save_register_global(machine, state->m_background_enable); state_save_register_global(machine(), m_background_red);
state_save_register_global(machine, state->m_background_red); state_save_register_global(machine(), m_background_green);
state_save_register_global(machine, state->m_background_green); state_save_register_global(machine(), m_background_blue);
state_save_register_global(machine, state->m_background_blue);
state_save_register_global_array(machine, state->m_gfxbank); state_save_register_global_array(machine(), m_gfxbank);
state_save_register_global(machine, state->m_stars_enabled); state_save_register_global(machine(), m_stars_enabled);
state_save_register_global(machine, state->m_star_rng_origin); state_save_register_global(machine(), m_star_rng_origin);
state_save_register_global(machine, state->m_star_rng_origin_frame); state_save_register_global(machine(), m_star_rng_origin_frame);
state_save_register_global(machine, state->m_stars_blink_state); state_save_register_global(machine(), m_stars_blink_state);
} }
@ -453,18 +432,18 @@ static void state_save_register(running_machine &machine)
UINT32 galaxian_state::screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) UINT32 galaxian_state::screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
/* draw the background layer (including stars) */ /* draw the background layer (including stars) */
(*m_draw_background_ptr)(machine(), bitmap, cliprect); (this->*m_draw_background_ptr)(bitmap, cliprect);
/* draw the tilemap characters over top */ /* draw the tilemap characters over top */
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* render the sprites next. Some custom pcbs (eg. zigzag, fantastc) have more than one sprite generator (ideally, this should be rendered in parallel) */ /* render the sprites next. Some custom pcbs (eg. zigzag, fantastc) have more than one sprite generator (ideally, this should be rendered in parallel) */
for (int i = 0; i < m_numspritegens; i++) for (int i = 0; i < m_numspritegens; i++)
sprites_draw(machine(), bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]); sprites_draw(bitmap, cliprect, &m_spriteram[0x40 + i * 0x20]);
/* if we have bullets to draw, render them following */ /* if we have bullets to draw, render them following */
if (m_draw_bullet_ptr != NULL) if (m_draw_bullet_ptr != NULL)
bullets_draw(machine(), bitmap, cliprect, &m_spriteram[m_bullets_base]); bullets_draw(bitmap, cliprect, &m_spriteram[m_bullets_base]);
return 0; return 0;
} }
@ -487,7 +466,7 @@ TILE_GET_INFO_MEMBER(galaxian_state::bg_get_tile_info)
UINT8 color = attrib & 7; UINT8 color = attrib & 7;
if (m_extend_tile_info_ptr != NULL) if (m_extend_tile_info_ptr != NULL)
(*m_extend_tile_info_ptr)(machine(), &code, &color, attrib, x); (this->*m_extend_tile_info_ptr)(&code, &color, attrib, x);
SET_TILE_INFO_MEMBER(0, code, color, 0); SET_TILE_INFO_MEMBER(0, code, color, 0);
} }
@ -545,9 +524,8 @@ WRITE8_MEMBER(galaxian_state::galaxian_objram_w)
* *
*************************************/ *************************************/
static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase) void galaxian_state::sprites_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *spritebase)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
rectangle clip = cliprect; rectangle clip = cliprect;
int sprnum; int sprnum;
@ -556,8 +534,8 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r
/* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */ /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */
/* according to the schematics, it should be the first 16 pixels */ /* according to the schematics, it should be the first 16 pixels */
clip.min_x = MAX(clip.min_x, (!state->m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE); clip.min_x = MAX(clip.min_x, (!m_flipscreen_x) * (16 + hoffset) * GALAXIAN_XSCALE);
clip.max_x = MIN(clip.max_x, (256 - state->m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1); clip.max_x = MIN(clip.max_x, (256 - m_flipscreen_x * (16 + hoffset)) * GALAXIAN_XSCALE - 1);
/* The line buffer is only written if it contains a '0' currently; */ /* The line buffer is only written if it contains a '0' currently; */
/* it is cleared during the visible area, and populated during HBLANK */ /* it is cleared during the visible area, and populated during HBLANK */
@ -567,7 +545,7 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r
{ {
const UINT8 *base = &spritebase[sprnum * 4]; const UINT8 *base = &spritebase[sprnum * 4];
/* Frogger: top and bottom 4 bits swapped entering the adder */ /* Frogger: top and bottom 4 bits swapped entering the adder */
UINT8 base0 = state->m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0]; UINT8 base0 = m_frogger_adjust ? ((base[0] >> 4) | (base[0] << 4)) : base[0];
/* the first three sprites match against y-1 */ /* the first three sprites match against y-1 */
UINT8 sy = 240 - (base0 - (sprnum < 3)); UINT8 sy = 240 - (base0 - (sprnum < 3));
UINT16 code = base[1] & 0x3f; UINT16 code = base[1] & 0x3f;
@ -577,18 +555,18 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r
UINT8 sx = base[3] + hoffset; UINT8 sx = base[3] + hoffset;
/* extend the sprite information */ /* extend the sprite information */
if (state->m_extend_sprite_info_ptr != NULL) if (m_extend_sprite_info_ptr != NULL)
(*state->m_extend_sprite_info_ptr)(machine, base, &sx, &sy, &flipx, &flipy, &code, &color); (this->*m_extend_sprite_info_ptr)(base, &sx, &sy, &flipx, &flipy, &code, &color);
/* apply flipscreen in X direction */ /* apply flipscreen in X direction */
if (state->m_flipscreen_x) if (m_flipscreen_x)
{ {
sx = 240 - sx; sx = 240 - sx;
flipx = !flipx; flipx = !flipx;
} }
/* apply flipscreen in Y direction */ /* apply flipscreen in Y direction */
if (state->m_flipscreen_y) if (m_flipscreen_y)
{ {
sy = 240 - sy; sy = 240 - sy;
flipy = !flipy; flipy = !flipy;
@ -596,7 +574,7 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r
/* draw */ /* draw */
drawgfx_transpen(bitmap, clip, drawgfx_transpen(bitmap, clip,
machine.gfx[1], machine().gfx[1],
code, color, code, color,
flipx, flipy, flipx, flipy,
GALAXIAN_H0START + GALAXIAN_XSCALE * sx, sy, 0); GALAXIAN_H0START + GALAXIAN_XSCALE * sx, sy, 0);
@ -611,9 +589,8 @@ static void sprites_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r
* *
*************************************/ *************************************/
static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base) void galaxian_state::bullets_draw(bitmap_rgb32 &bitmap, const rectangle &cliprect, const UINT8 *base)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
int y; int y;
/* iterate over scanlines */ /* iterate over scanlines */
@ -624,13 +601,13 @@ static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r
int which; int which;
/* the first 3 entries match Y-1 */ /* the first 3 entries match Y-1 */
effy = state->m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1); effy = m_flipscreen_y ? ((y - 1) ^ 255) : (y - 1);
for (which = 0; which < 3; which++) for (which = 0; which < 3; which++)
if ((UINT8)(base[which*4+1] + effy) == 0xff) if ((UINT8)(base[which*4+1] + effy) == 0xff)
shell = which; shell = which;
/* remaining entries match Y */ /* remaining entries match Y */
effy = state->m_flipscreen_y ? (y ^ 255) : y; effy = m_flipscreen_y ? (y ^ 255) : y;
for (which = 3; which < 8; which++) for (which = 3; which < 8; which++)
if ((UINT8)(base[which*4+1] + effy) == 0xff) if ((UINT8)(base[which*4+1] + effy) == 0xff)
{ {
@ -642,9 +619,9 @@ static void bullets_draw(running_machine &machine, bitmap_rgb32 &bitmap, const r
/* draw the shell */ /* draw the shell */
if (shell != 0xff) if (shell != 0xff)
(*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, shell, 255 - base[shell*4+3], y); (this->*m_draw_bullet_ptr)(bitmap, cliprect, shell, 255 - base[shell*4+3], y);
if (missile != 0xff) if (missile != 0xff)
(*state->m_draw_bullet_ptr)(machine, bitmap, cliprect, missile, 255 - base[missile*4+3], y); (this->*m_draw_bullet_ptr)(bitmap, cliprect, missile, 255 - base[missile*4+3], y);
} }
} }
@ -665,7 +642,7 @@ WRITE8_MEMBER(galaxian_state::galaxian_flip_screen_x_w)
/* when the direction changes, we count a different number of clocks */ /* when the direction changes, we count a different number of clocks */
/* per frame, so we need to reset the origin of the stars to the current */ /* per frame, so we need to reset the origin of the stars to the current */
/* frame before we flip */ /* frame before we flip */
stars_update_origin(machine()); stars_update_origin();
m_flipscreen_x = data & 0x01; m_flipscreen_x = data & 0x01;
m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0)); m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0));
@ -774,18 +751,17 @@ WRITE8_MEMBER(galaxian_state::galaxian_gfxbank_w)
* *
*************************************/ *************************************/
static void stars_init(running_machine &machine) void galaxian_state::stars_init()
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
UINT32 shiftreg; UINT32 shiftreg;
int i; int i;
/* reset the blink and enabled states */ /* reset the blink and enabled states */
state->m_stars_enabled = FALSE; m_stars_enabled = FALSE;
state->m_stars_blink_state = 0; m_stars_blink_state = 0;
/* precalculate the RNG */ /* precalculate the RNG */
state->m_stars = auto_alloc_array(machine, UINT8, STAR_RNG_PERIOD); m_stars = auto_alloc_array(machine(), UINT8, STAR_RNG_PERIOD);
shiftreg = 0; shiftreg = 0;
for (i = 0; i < STAR_RNG_PERIOD; i++) for (i = 0; i < STAR_RNG_PERIOD; i++)
{ {
@ -796,7 +772,7 @@ static void stars_init(running_machine &machine)
int color = (~shiftreg & 0x1f8) >> 3; int color = (~shiftreg & 0x1f8) >> 3;
/* store the color value in the low 6 bits and the enable in the upper bit */ /* store the color value in the low 6 bits and the enable in the upper bit */
state->m_stars[i] = color | (enabled << 7); m_stars[i] = color | (enabled << 7);
/* the LFSR is fed based on the XOR of bit 12 and the inverse of bit 0 */ /* the LFSR is fed based on the XOR of bit 12 and the inverse of bit 0 */
shiftreg = (shiftreg >> 1) | ((((shiftreg >> 12) ^ ~shiftreg) & 1) << 16); shiftreg = (shiftreg >> 1) | ((((shiftreg >> 12) ^ ~shiftreg) & 1) << 16);
@ -811,13 +787,12 @@ static void stars_init(running_machine &machine)
* *
*************************************/ *************************************/
static void stars_update_origin(running_machine &machine) void galaxian_state::stars_update_origin()
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); int curframe = machine().primary_screen->frame_number();
int curframe = machine.primary_screen->frame_number();
/* only update on a different frame */ /* only update on a different frame */
if (curframe != state->m_star_rng_origin_frame) if (curframe != m_star_rng_origin_frame)
{ {
/* The RNG period is 2^17-1; each frame, the shift register is clocked */ /* The RNG period is 2^17-1; each frame, the shift register is clocked */
/* 512*256 = 2^17 times. This means that we clock one extra time each */ /* 512*256 = 2^17 times. This means that we clock one extra time each */
@ -825,16 +800,16 @@ static void stars_update_origin(running_machine &machine)
/* at 6B which delay the count so that we count 512*256-2 = 2^17-2 times. */ /* at 6B which delay the count so that we count 512*256-2 = 2^17-2 times. */
/* In this case, we only one time less than the period each frame. Both */ /* In this case, we only one time less than the period each frame. Both */
/* of these off-by-one countings produce the horizontal star scrolling. */ /* of these off-by-one countings produce the horizontal star scrolling. */
int per_frame_delta = state->m_flipscreen_x ? 1 : -1; int per_frame_delta = m_flipscreen_x ? 1 : -1;
int total_delta = per_frame_delta * (curframe - state->m_star_rng_origin_frame); int total_delta = per_frame_delta * (curframe - m_star_rng_origin_frame);
/* we can't just use % here because mod of a negative number is undefined */ /* we can't just use % here because mod of a negative number is undefined */
while (total_delta < 0) while (total_delta < 0)
total_delta += STAR_RNG_PERIOD; total_delta += STAR_RNG_PERIOD;
/* now that everything is positive, do the mod */ /* now that everything is positive, do the mod */
state->m_star_rng_origin = (state->m_star_rng_origin + total_delta) % STAR_RNG_PERIOD; m_star_rng_origin = (m_star_rng_origin + total_delta) % STAR_RNG_PERIOD;
state->m_star_rng_origin_frame = curframe; m_star_rng_origin_frame = curframe;
} }
} }
@ -859,7 +834,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(galaxian_state::galaxian_stars_blink_timer)
* *
*************************************/ *************************************/
static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask) void galaxian_state::stars_draw_row(bitmap_rgb32 &bitmap, int maxx, int y, UINT32 star_offs, UINT8 starmask)
{ {
int x; int x;
@ -891,20 +866,20 @@ static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx
*/ */
/* first RNG clock: one pixel */ /* first RNG clock: one pixel */
star = state->m_stars[star_offs++]; star = m_stars[star_offs++];
if (star_offs >= STAR_RNG_PERIOD) if (star_offs >= STAR_RNG_PERIOD)
star_offs = 0; star_offs = 0;
if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0)
bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = state->m_star_color[star & 0x3f]; bitmap.pix32(y, GALAXIAN_XSCALE*x + 0) = m_star_color[star & 0x3f];
/* second RNG clock: two pixels */ /* second RNG clock: two pixels */
star = state->m_stars[star_offs++]; star = m_stars[star_offs++];
if (star_offs >= STAR_RNG_PERIOD) if (star_offs >= STAR_RNG_PERIOD)
star_offs = 0; star_offs = 0;
if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0) if (enable_star && (star & 0x80) != 0 && (star & starmask) != 0)
{ {
bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = state->m_star_color[star & 0x3f]; bitmap.pix32(y, GALAXIAN_XSCALE*x + 1) = m_star_color[star & 0x3f];
bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = state->m_star_color[star & 0x3f]; bitmap.pix32(y, GALAXIAN_XSCALE*x + 2) = m_star_color[star & 0x3f];
} }
} }
} }
@ -917,35 +892,33 @@ static void stars_draw_row(galaxian_state *state, bitmap_rgb32 &bitmap, int maxx
* *
*************************************/ *************************************/
void galaxian_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void galaxian_state::galaxian_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* erase the background to black first */ /* erase the background to black first */
bitmap.fill(RGB_BLACK, cliprect); bitmap.fill(RGB_BLACK, cliprect);
/* update the star origin to the current frame */ /* update the star origin to the current frame */
stars_update_origin(machine); stars_update_origin();
/* render stars if enabled */ /* render stars if enabled */
if (state->m_stars_enabled) if (m_stars_enabled)
{ {
int y; int y;
/* iterate over scanlines */ /* iterate over scanlines */
for (y = cliprect.min_y; y <= cliprect.max_y; y++) for (y = cliprect.min_y; y <= cliprect.max_y; y++)
{ {
UINT32 star_offs = state->m_star_rng_origin + y * 512; UINT32 star_offs = m_star_rng_origin + y * 512;
stars_draw_row(state, bitmap, 256, y, star_offs, 0xff); stars_draw_row(bitmap, 256, y, star_offs, 0xff);
} }
} }
} }
static void background_draw_colorsplit(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped) void galaxian_state::background_draw_colorsplit(bitmap_rgb32 &bitmap, const rectangle &cliprect, rgb_t color, int split, int split_flipped)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* horizontal bgcolor split */ /* horizontal bgcolor split */
if (state->m_flipscreen_x) if (m_flipscreen_x)
{ {
rectangle draw = cliprect; rectangle draw = cliprect;
draw.max_x = MIN(draw.max_x, split_flipped * GALAXIAN_XSCALE - 1); draw.max_x = MIN(draw.max_x, split_flipped * GALAXIAN_XSCALE - 1);
@ -972,16 +945,15 @@ static void background_draw_colorsplit(running_machine &machine, bitmap_rgb32 &b
} }
static void scramble_draw_stars(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx) void galaxian_state::scramble_draw_stars(bitmap_rgb32 &bitmap, const rectangle &cliprect, int maxx)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* update the star origin to the current frame */ /* update the star origin to the current frame */
stars_update_origin(machine); stars_update_origin();
/* render stars if enabled */ /* render stars if enabled */
if (state->m_stars_enabled) if (m_stars_enabled)
{ {
int blink_state = state->m_stars_blink_state & 3; int blink_state = m_stars_blink_state & 3;
int y; int y;
/* iterate over scanlines */ /* iterate over scanlines */
@ -992,47 +964,43 @@ static void scramble_draw_stars(running_machine &machine, bitmap_rgb32 &bitmap,
{ {
/* blink states 0 and 1 suppress stars when certain bits of the color == 0 */ /* blink states 0 and 1 suppress stars when certain bits of the color == 0 */
static const UINT8 colormask_table[4] = { 0x20, 0x08, 0xff, 0xff }; static const UINT8 colormask_table[4] = { 0x20, 0x08, 0xff, 0xff };
stars_draw_row(state, bitmap, maxx, y, y * 512, colormask_table[blink_state]); stars_draw_row(bitmap, maxx, y, y * 512, colormask_table[blink_state]);
} }
} }
} }
} }
void scramble_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void galaxian_state::scramble_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* blue background - 390 ohm resistor */ /* blue background - 390 ohm resistor */
bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect);
scramble_draw_stars(machine, bitmap, cliprect, 256); scramble_draw_stars(bitmap, cliprect, 256);
} }
void anteater_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void galaxian_state::anteater_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* blue background, horizontal split as seen on flyer and real cabinet */ /* blue background, horizontal split as seen on flyer and real cabinet */
background_draw_colorsplit(machine, bitmap, cliprect, state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56); background_draw_colorsplit(bitmap, cliprect, m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, 56, 256-56);
scramble_draw_stars(machine, bitmap, cliprect, 256); scramble_draw_stars(bitmap, cliprect, 256);
} }
void jumpbug_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void galaxian_state::jumpbug_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* blue background - 390 ohm resistor */ /* blue background - 390 ohm resistor */
bitmap.fill(state->m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect); bitmap.fill(m_background_enable ? MAKE_RGB(0,0,0x56) : RGB_BLACK, cliprect);
/* render stars same as scramble but nothing in the status area */ /* render stars same as scramble but nothing in the status area */
scramble_draw_stars(machine, bitmap, cliprect, 240); scramble_draw_stars(bitmap, cliprect, 240);
} }
void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void galaxian_state::turtles_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* /*
The background color generator is connected this way: The background color generator is connected this way:
@ -1040,24 +1008,23 @@ void turtles_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, con
GREEN - 470 ohm resistor GREEN - 470 ohm resistor
BLUE - 390 ohm resistor BLUE - 390 ohm resistor
*/ */
bitmap.fill(MAKE_RGB(state->m_background_red * 0x55, state->m_background_green * 0x47, state->m_background_blue * 0x55), cliprect); bitmap.fill(MAKE_RGB(m_background_red * 0x55, m_background_green * 0x47, m_background_blue * 0x55), cliprect);
} }
void frogger_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void galaxian_state::frogger_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
/* color split point verified on real machine */ /* color split point verified on real machine */
/* hmmm, according to schematics it is at 128+8; which is right? */ /* hmmm, according to schematics it is at 128+8; which is right? */
background_draw_colorsplit(machine, bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8); background_draw_colorsplit(bitmap, cliprect, MAKE_RGB(0,0,0x47), 128+8, 128-8);
} }
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
static int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect) int galaxian_state::flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle &cliprect)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
draw = cliprect; draw = cliprect;
if (!state->m_flipscreen_x) if (!m_flipscreen_x)
{ {
draw.min_x = xstart * GALAXIAN_XSCALE; draw.min_x = xstart * GALAXIAN_XSCALE;
draw.max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1); draw.max_x = xend * GALAXIAN_XSCALE + (GALAXIAN_XSCALE - 1);
@ -1071,10 +1038,9 @@ static int flip_and_clip(rectangle &draw, int xstart, int xend, const rectangle
return (draw.min_x <= draw.max_x); return (draw.min_x <= draw.max_x);
} }
void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void galaxian_state::amidar_draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); const UINT8 *prom = memregion("user1")->base();
const UINT8 *prom = state->memregion("user1")->base();
rectangle draw; rectangle draw;
int x; int x;
@ -1095,9 +1061,9 @@ void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons
GREEN - 560 ohm resistor GREEN - 560 ohm resistor
BLUE - 470 ohm resistor BLUE - 470 ohm resistor
*/ */
UINT8 red = ((~prom[x] & 0x02) && state->m_background_red) ? 0x7c : 0x00; UINT8 red = ((~prom[x] & 0x02) && m_background_red) ? 0x7c : 0x00;
UINT8 green = ((~prom[x] & 0x02) && state->m_background_green) ? 0x3c : 0x00; UINT8 green = ((~prom[x] & 0x02) && m_background_green) ? 0x3c : 0x00;
UINT8 blue = ((~prom[x] & 0x01) && state->m_background_blue) ? 0x47 : 0x00; UINT8 blue = ((~prom[x] & 0x01) && m_background_blue) ? 0x47 : 0x00;
bitmap.fill(MAKE_RGB(red, green, blue, draw)); bitmap.fill(MAKE_RGB(red, green, blue, draw));
} }
} }
@ -1111,7 +1077,7 @@ void amidar_draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons
* *
*************************************/ *************************************/
INLINE void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color) inline void galaxian_state::galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect, int y, int x, rgb_t color)
{ {
if (y >= cliprect.min_y && y <= cliprect.max_y) if (y >= cliprect.min_y && y <= cliprect.max_y)
{ {
@ -1131,9 +1097,8 @@ INLINE void galaxian_draw_pixel(bitmap_rgb32 &bitmap, const rectangle &cliprect,
} }
void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) void galaxian_state::galaxian_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* /*
Both "shells" and "missiles" begin displaying when the horizontal counter Both "shells" and "missiles" begin displaying when the horizontal counter
reaches $FC, and they stop displaying when it reaches $00, resulting in reaches $FC, and they stop displaying when it reaches $00, resulting in
@ -1141,14 +1106,14 @@ void galaxian_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const
white; the final entry is called a "missile" and renders as yellow. white; the final entry is called a "missile" and renders as yellow.
*/ */
x -= 4; x -= 4;
galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
galaxian_draw_pixel(bitmap, cliprect, y, x++, state->m_bullet_color[offs]); galaxian_draw_pixel(bitmap, cliprect, y, x++, m_bullet_color[offs]);
} }
void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) void galaxian_state::mshuttle_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
{ {
/* verified by schematics: /* verified by schematics:
* both "W" and "Y" bullets are 4 pixels long * both "W" and "Y" bullets are 4 pixels long
@ -1177,7 +1142,7 @@ void mshuttle_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const
} }
void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) void galaxian_state::scramble_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
{ {
/* /*
Scramble only has "shells", which begin displaying when the counter Scramble only has "shells", which begin displaying when the counter
@ -1189,15 +1154,14 @@ void scramble_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const
} }
void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y) void galaxian_state::theend_draw_bullet(bitmap_rgb32 &bitmap, const rectangle &cliprect, int offs, int x, int y)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
/* Same as galaxian except blue/green are swapped */ /* Same as galaxian except blue/green are swapped */
x -= 4; x -= 4;
galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(state->m_bullet_color[offs]), RGB_BLUE(state->m_bullet_color[offs]), RGB_GREEN(state->m_bullet_color[offs]))); galaxian_draw_pixel(bitmap, cliprect, y, x++, MAKE_RGB(RGB_RED(m_bullet_color[offs]), RGB_BLUE(m_bullet_color[offs]), RGB_GREEN(m_bullet_color[offs])));
} }
@ -1209,13 +1173,13 @@ void theend_draw_bullet(running_machine &machine, bitmap_rgb32 &bitmap, const re
*************************************/ *************************************/
/*** generic ***/ /*** generic ***/
void upper_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::upper_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
/* tiles are in the upper half of a larger ROM */ /* tiles are in the upper half of a larger ROM */
*code += 0x100; *code += 0x100;
} }
void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::upper_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
/* sprites are in the upper half of a larger ROM */ /* sprites are in the upper half of a larger ROM */
*code += 0x40; *code += 0x40;
@ -1223,98 +1187,91 @@ void upper_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8
/*** Frogger ***/ /*** Frogger ***/
void frogger_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::frogger_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
*color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04);
} }
void frogger_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::frogger_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
*color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04); *color = ((*color >> 1) & 0x03) | ((*color << 2) & 0x04);
} }
/*** Ghostmuncher Galaxian ***/ /*** Ghostmuncher Galaxian ***/
void gmgalax_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::gmgalax_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); *code |= m_gfxbank[0] << 9;
*code |= state->m_gfxbank[0] << 9; // *color |= m_gfxbank[0] << 3;
// *color |= state->m_gfxbank[0] << 3;
} }
void gmgalax_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::gmgalax_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); *code |= (m_gfxbank[0] << 7) | 0x40;
*code |= (state->m_gfxbank[0] << 7) | 0x40; *color |= m_gfxbank[0] << 3;
*color |= state->m_gfxbank[0] << 3;
} }
/*** Pisces ***/ /*** Pisces ***/
void pisces_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::pisces_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); *code |= m_gfxbank[0] << 8;
*code |= state->m_gfxbank[0] << 8;
} }
void pisces_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::pisces_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); *code |= m_gfxbank[0] << 6;
*code |= state->m_gfxbank[0] << 6;
} }
/*** Batman Part 2 ***/ /*** Batman Part 2 ***/
void batman2_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::batman2_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>();
if (*code & 0x80) if (*code & 0x80)
*code |= state->m_gfxbank[0] << 8; *code |= m_gfxbank[0] << 8;
} }
/*** Moon Cresta ***/ /*** Moon Cresta ***/
void mooncrst_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::mooncrst_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); if (m_gfxbank[2] && (*code & 0xc0) == 0x80)
if (state->m_gfxbank[2] && (*code & 0xc0) == 0x80) *code = (*code & 0x3f) | (m_gfxbank[0] << 6) | (m_gfxbank[1] << 7) | 0x0100;
*code = (*code & 0x3f) | (state->m_gfxbank[0] << 6) | (state->m_gfxbank[1] << 7) | 0x0100;
} }
void mooncrst_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::mooncrst_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); if (m_gfxbank[2] && (*code & 0x30) == 0x20)
if (state->m_gfxbank[2] && (*code & 0x30) == 0x20) *code = (*code & 0x0f) | (m_gfxbank[0] << 4) | (m_gfxbank[1] << 5) | 0x40;
*code = (*code & 0x0f) | (state->m_gfxbank[0] << 4) | (state->m_gfxbank[1] << 5) | 0x40;
} }
/*** Moon Quasar ***/ /*** Moon Quasar ***/
void moonqsr_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::moonqsr_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
*code |= (attrib & 0x20) << 3; *code |= (attrib & 0x20) << 3;
} }
void moonqsr_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::moonqsr_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
*code |= (base[2] & 0x20) << 1; *code |= (base[2] & 0x20) << 1;
} }
/*** Moon Shuttle ***/ /*** Moon Shuttle ***/
void mshuttle_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::mshuttle_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
*code |= (attrib & 0x30) << 4; *code |= (attrib & 0x30) << 4;
} }
void mshuttle_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::mshuttle_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
*code |= (base[2] & 0x30) << 2; *code |= (base[2] & 0x30) << 2;
} }
/*** Calipso ***/ /*** Calipso ***/
void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::calipso_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
/* same as the others, but no sprite flipping, but instead the bits are used /* same as the others, but no sprite flipping, but instead the bits are used
as extra sprite code bits, giving 256 sprite images */ as extra sprite code bits, giving 256 sprite images */
@ -1326,22 +1283,20 @@ void calipso_extend_sprite_info(running_machine &machine, const UINT8 *base, UIN
/*** Jumpbug ***/ /*** Jumpbug ***/
void jumpbug_extend_tile_info(running_machine &machine, UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x) void galaxian_state::jumpbug_extend_tile_info(UINT16 *code, UINT8 *color, UINT8 attrib, UINT8 x)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); if ((*code & 0xc0) == 0x80 && (m_gfxbank[2] & 0x01))
if ((*code & 0xc0) == 0x80 && (state->m_gfxbank[2] & 0x01)) *code += 128 + (( m_gfxbank[0] & 0x01) << 6) +
*code += 128 + (( state->m_gfxbank[0] & 0x01) << 6) + (( m_gfxbank[1] & 0x01) << 7) +
(( state->m_gfxbank[1] & 0x01) << 7) + ((~m_gfxbank[4] & 0x01) << 8);
((~state->m_gfxbank[4] & 0x01) << 8);
} }
void jumpbug_extend_sprite_info(running_machine &machine, const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color) void galaxian_state::jumpbug_extend_sprite_info(const UINT8 *base, UINT8 *sx, UINT8 *sy, UINT8 *flipx, UINT8 *flipy, UINT16 *code, UINT8 *color)
{ {
galaxian_state *state = machine.driver_data<galaxian_state>(); if ((*code & 0x30) == 0x20 && (m_gfxbank[2] & 0x01) != 0)
if ((*code & 0x30) == 0x20 && (state->m_gfxbank[2] & 0x01) != 0)
{ {
*code += 32 + (( state->m_gfxbank[0] & 0x01) << 4) + *code += 32 + (( m_gfxbank[0] & 0x01) << 4) +
(( state->m_gfxbank[1] & 0x01) << 5) + (( m_gfxbank[1] & 0x01) << 5) +
((~state->m_gfxbank[4] & 0x01) << 6); ((~m_gfxbank[4] & 0x01) << 6);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -294,15 +294,14 @@ WRITE8_MEMBER(galivan_state::galivan_scrolly_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void galivan_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
galivan_state *state = machine.driver_data<galivan_state>(); const UINT8 *spritepalettebank = memregion("user1")->base();
const UINT8 *spritepalettebank = state->memregion("user1")->base(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
/* draw the sprites */ /* draw the sprites */
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{ {
int code; int code;
int attr = spriteram[offs + 2]; int attr = spriteram[offs + 2];
@ -313,7 +312,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
sx = (spriteram[offs + 3] - 0x80) + 256 * (attr & 0x01); sx = (spriteram[offs + 3] - 0x80) + 256 * (attr & 0x01);
sy = 240 - spriteram[offs]; sy = 240 - spriteram[offs];
if (state->m_flipscreen) if (m_flipscreen)
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -324,7 +323,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
// code = spriteram[offs + 1] + ((attr & 0x02) << 7); // code = spriteram[offs + 1] + ((attr & 0x02) << 7);
code = spriteram[offs + 1] + ((attr & 0x06) << 7); // for ninjemak, not sure ? code = spriteram[offs + 1] + ((attr & 0x06) << 7); // for ninjemak, not sure ?
drawgfx_transpen(bitmap,cliprect,machine.gfx[2], drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
code, code,
color + 16 * (spritepalettebank[code >> 2] & 0x0f), color + 16 * (spritepalettebank[code >> 2] & 0x0f),
flipx,flipy, flipx,flipy,
@ -347,11 +346,11 @@ UINT32 galivan_state::screen_update_galivan(screen_device &screen, bitmap_ind16
{ {
m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
m_tx_tilemap->draw(bitmap, cliprect, 1, 0); m_tx_tilemap->draw(bitmap, cliprect, 1, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
} }
else else
{ {
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
m_tx_tilemap->draw(bitmap, cliprect, 1, 0); m_tx_tilemap->draw(bitmap, cliprect, 1, 0);
} }
@ -370,7 +369,7 @@ UINT32 galivan_state::screen_update_ninjemak(screen_device &screen, bitmap_ind16
else else
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }

View File

@ -45,14 +45,13 @@ WRITE16_HANDLER( galpanic_paletteram_w )
} }
static void comad_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void galpanic_state::comad_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
galpanic_state *state = machine.driver_data<galpanic_state>(); UINT16 *spriteram16 = m_spriteram;
UINT16 *spriteram16 = state->m_spriteram;
int offs; int offs;
int sx=0, sy=0; int sx=0, sy=0;
for (offs = 0;offs < state->m_spriteram.bytes()/2;offs += 4) for (offs = 0;offs < m_spriteram.bytes()/2;offs += 4)
{ {
int code,color,flipx,flipy; int code,color,flipx,flipy;
@ -75,7 +74,7 @@ static void comad_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, c
sx = (sx&0x1ff) - (sx&0x200); sx = (sx&0x1ff) - (sx&0x200);
sy = (sy&0x1ff) - (sy&0x200); sy = (sy&0x1ff) - (sy&0x200);
drawgfx_transpen(bitmap,cliprect,machine.gfx[0], drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -83,18 +82,17 @@ static void comad_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, c
} }
} }
static void draw_fgbitmap(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void galpanic_state::draw_fgbitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
galpanic_state *state = machine.driver_data<galpanic_state>();
int offs; int offs;
for (offs = 0;offs < state->m_fgvideoram.bytes()/2;offs++) for (offs = 0;offs < m_fgvideoram.bytes()/2;offs++)
{ {
int sx,sy,color; int sx,sy,color;
sx = offs % 256; sx = offs % 256;
sy = offs / 256; sy = offs / 256;
color = state->m_fgvideoram[offs]; color = m_fgvideoram[offs];
if (color) if (color)
bitmap.pix16(sy, sx) = color; bitmap.pix16(sy, sx) = color;
} }
@ -107,7 +105,7 @@ UINT32 galpanic_state::screen_update_galpanic(screen_device &screen, bitmap_ind1
/* copy the temporary bitmap to the screen */ /* copy the temporary bitmap to the screen */
copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect); copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect);
draw_fgbitmap(machine(), bitmap, cliprect); draw_fgbitmap(bitmap, cliprect);
pandora_update(pandora, bitmap, cliprect); pandora_update(pandora, bitmap, cliprect);
@ -119,13 +117,13 @@ UINT32 galpanic_state::screen_update_comad(screen_device &screen, bitmap_ind16 &
/* copy the temporary bitmap to the screen */ /* copy the temporary bitmap to the screen */
copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect); copybitmap(bitmap,m_bitmap,0,0,0,0,cliprect);
draw_fgbitmap(machine(), bitmap, cliprect); draw_fgbitmap(bitmap, cliprect);
// if(galpanic_clear_sprites) // if(galpanic_clear_sprites)
{ {
m_sprites_bitmap.fill(0, cliprect); m_sprites_bitmap.fill(0, cliprect);
comad_draw_sprites(machine(),bitmap,cliprect); comad_draw_sprites(bitmap,cliprect);
} }
// else // else
// { // {

View File

@ -13,19 +13,18 @@ void galspnbl_state::palette_init()
static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void galspnbl_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
galspnbl_state *state = machine.driver_data<galspnbl_state>();
offs_t offs; offs_t offs;
// int screenscroll = 4 - (state->m_scroll[0] & 0xff); // int screenscroll = 4 - (m_scroll[0] & 0xff);
for (offs = 0; offs < 0x20000; offs++) for (offs = 0; offs < 0x20000; offs++)
{ {
int y = offs >> 9; int y = offs >> 9;
int x = offs & 0x1ff; int x = offs & 0x1ff;
bitmap.pix16(y, x) = 1024 + (state->m_bgvideoram[offs] >> 1); bitmap.pix16(y, x) = 1024 + (m_bgvideoram[offs] >> 1);
} }
} }
@ -34,7 +33,7 @@ UINT32 galspnbl_state::screen_update_galspnbl(screen_device &screen, bitmap_ind1
{ {
int offs; int offs;
draw_background(machine(), bitmap, cliprect); draw_background(bitmap, cliprect);
galspnbl_draw_sprites(machine(), bitmap, cliprect, 0, m_spriteram, m_spriteram.bytes()); galspnbl_draw_sprites(machine(), bitmap, cliprect, 0, m_spriteram, m_spriteram.bytes());

View File

@ -36,7 +36,7 @@ driver by Chris Moore
* *
*************************************/ *************************************/
static void gameplan_get_pens( pen_t *pens ) void gameplan_state::gameplan_get_pens( pen_t *pens )
{ {
offs_t i; offs_t i;
@ -46,7 +46,7 @@ static void gameplan_get_pens( pen_t *pens )
/* RGBI palette. Is it correct, or does it use the standard RGB? */ /* RGBI palette. Is it correct, or does it use the standard RGB? */
static void leprechn_get_pens( pen_t *pens ) void gameplan_state::leprechn_get_pens( pen_t *pens )
{ {
offs_t i; offs_t i;

View File

@ -125,18 +125,17 @@ TILE_GET_INFO_MEMBER(gaplus_state::get_tile_info)
#define SPEED_2 1.0 #define SPEED_2 1.0
#define SPEED_3 2.0 #define SPEED_3 2.0
static void starfield_init(running_machine &machine) void gaplus_state::starfield_init()
{ {
gaplus_state *state = machine.driver_data<gaplus_state>(); struct star *stars = m_stars;
struct star *stars = state->m_stars;
int generator = 0; int generator = 0;
int x,y; int x,y;
int set = 0; int set = 0;
int width = machine.primary_screen->width(); int width = machine().primary_screen->width();
int height = machine.primary_screen->height(); int height = machine().primary_screen->height();
state->m_total_stars = 0; m_total_stars = 0;
/* precalculate the star background */ /* precalculate the star background */
/* this comes from the Galaxian hardware, Gaplus is probably different */ /* this comes from the Galaxian hardware, Gaplus is probably different */
@ -155,16 +154,16 @@ static void starfield_init(running_machine &machine)
int color; int color;
color = (~(generator >> 8)) & 0x3f; color = (~(generator >> 8)) & 0x3f;
if ( color && state->m_total_stars < MAX_STARS ) { if ( color && m_total_stars < MAX_STARS ) {
stars[state->m_total_stars].x = x; stars[m_total_stars].x = x;
stars[state->m_total_stars].y = y; stars[m_total_stars].y = y;
stars[state->m_total_stars].col = color; stars[m_total_stars].col = color;
stars[state->m_total_stars].set = set++; stars[m_total_stars].set = set++;
if ( set == 3 ) if ( set == 3 )
set = 0; set = 0;
state->m_total_stars++; m_total_stars++;
} }
} }
} }
@ -185,7 +184,7 @@ void gaplus_state::video_start()
colortable_configure_tilemap_groups(machine().colortable, m_bg_tilemap, machine().gfx[0], 0xff); colortable_configure_tilemap_groups(machine().colortable, m_bg_tilemap, machine().gfx[0], 0xff);
starfield_init(machine()); starfield_init();
} }
@ -221,21 +220,20 @@ WRITE8_MEMBER(gaplus_state::gaplus_starfield_control_w)
***************************************************************************/ ***************************************************************************/
static void starfield_render(running_machine &machine, bitmap_ind16 &bitmap) void gaplus_state::starfield_render(bitmap_ind16 &bitmap)
{ {
gaplus_state *state = machine.driver_data<gaplus_state>(); struct star *stars = m_stars;
struct star *stars = state->m_stars;
int i; int i;
int width = machine.primary_screen->width(); int width = machine().primary_screen->width();
int height = machine.primary_screen->height(); int height = machine().primary_screen->height();
/* check if we're running */ /* check if we're running */
if ( ( state->m_starfield_control[0] & 1 ) == 0 ) if ( ( m_starfield_control[0] & 1 ) == 0 )
return; return;
/* draw the starfields */ /* draw the starfields */
for ( i = 0; i < state->m_total_stars; i++ ) for ( i = 0; i < m_total_stars; i++ )
{ {
int x, y; int x, y;
@ -249,10 +247,9 @@ static void starfield_render(running_machine &machine, bitmap_ind16 &bitmap)
} }
} }
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gaplus_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
gaplus_state *state = machine.driver_data<gaplus_state>(); UINT8 *spriteram = m_spriteram + 0x780;
UINT8 *spriteram = state->m_spriteram + 0x780;
UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_2 = spriteram + 0x800;
UINT8 *spriteram_3 = spriteram_2 + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800;
int offs; int offs;
@ -278,7 +275,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
int duplicate = spriteram_3[offs] & 0x80; int duplicate = spriteram_3[offs] & 0x80;
int x,y; int x,y;
if (state->flip_screen()) if (flip_screen())
{ {
flipx ^= 1; flipx ^= 1;
flipy ^= 1; flipy ^= 1;
@ -291,12 +288,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
{ {
for (x = 0;x <= sizex;x++) for (x = 0;x <= sizex;x++)
{ {
drawgfx_transmask(bitmap,cliprect,machine.gfx[1], drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
sprite + (duplicate ? 0 : (gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)])), sprite + (duplicate ? 0 : (gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)])),
color, color,
flipx,flipy, flipx,flipy,
sx + 16*x,sy + 16*y, sx + 16*x,sy + 16*y,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0xff)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0xff));
} }
} }
} }
@ -310,12 +307,12 @@ UINT32 gaplus_state::screen_update_gaplus(screen_device &screen, bitmap_ind16 &b
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
starfield_render(machine(), bitmap); starfield_render(bitmap);
/* draw the low priority characters */ /* draw the low priority characters */
m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_bg_tilemap->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
/* draw the high priority characters */ /* draw the high priority characters */
/* (I don't know if this feature is used by Gaplus, but it's shown in the schematics) */ /* (I don't know if this feature is used by Gaplus, but it's shown in the schematics) */

View File

@ -125,16 +125,15 @@ VIDEO_START_MEMBER(gberet_state,gberet)
m_bg_tilemap->set_scroll_rows(32); m_bg_tilemap->set_scroll_rows(32);
} }
static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gberet_state::gberet_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
gberet_state *state = machine.driver_data<gberet_state>();
int offs; int offs;
UINT8 *sr; UINT8 *sr;
if (state->m_spritebank & 0x08) if (m_spritebank & 0x08)
sr = state->m_spriteram2; sr = m_spriteram2;
else else
sr = state->m_spriteram; sr = m_spriteram;
for (offs = 0; offs < 0xc0; offs += 4) for (offs = 0; offs < 0xc0; offs += 4)
{ {
@ -148,7 +147,7 @@ static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
int flipx = attr & 0x10; int flipx = attr & 0x10;
int flipy = attr & 0x20; int flipy = attr & 0x20;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -156,8 +155,8 @@ static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
} }
} }
} }
@ -165,7 +164,7 @@ static void gberet_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
UINT32 gberet_state::screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 gberet_state::screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
gberet_draw_sprites(machine(), bitmap, cliprect); gberet_draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }
@ -183,13 +182,12 @@ WRITE8_MEMBER(gberet_state::gberetb_scroll_w)
m_bg_tilemap->set_scrollx(offset, scroll + 64 - 8); m_bg_tilemap->set_scrollx(offset, scroll + 64 - 8);
} }
static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gberet_state::gberetb_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
gberet_state *state = machine.driver_data<gberet_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{ {
if (spriteram[offs + 1]) if (spriteram[offs + 1])
{ {
@ -201,7 +199,7 @@ static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap
int flipx = attr & 0x10; int flipx = attr & 0x10;
int flipy = attr & 0x20; int flipy = attr & 0x20;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -209,8 +207,8 @@ static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 0)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 0));
} }
} }
} }
@ -218,7 +216,7 @@ static void gberetb_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap
UINT32 gberet_state::screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 gberet_state::screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
gberetb_draw_sprites(machine(), bitmap, cliprect); gberetb_draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }

View File

@ -40,32 +40,31 @@ TILE_GET_INFO_MEMBER(gcpinbal_state::get_fg_tile_info)
0); 0);
} }
static void gcpinbal_core_vh_start( running_machine &machine ) void gcpinbal_state::gcpinbal_core_vh_start( )
{ {
gcpinbal_state *state = machine.driver_data<gcpinbal_state>();
int xoffs = 0; int xoffs = 0;
int yoffs = 0; int yoffs = 0;
state->m_tilemap[0] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg0_tile_info),state),TILEMAP_SCAN_ROWS,16,16,32,32); m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg0_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
state->m_tilemap[1] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg1_tile_info),state),TILEMAP_SCAN_ROWS,16,16,32,32); m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_bg1_tile_info),this),TILEMAP_SCAN_ROWS,16,16,32,32);
state->m_tilemap[2] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_fg_tile_info),state), TILEMAP_SCAN_ROWS,8,8,64,64); m_tilemap[2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gcpinbal_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS,8,8,64,64);
state->m_tilemap[0]->set_transparent_pen(0); m_tilemap[0]->set_transparent_pen(0);
state->m_tilemap[1]->set_transparent_pen(0); m_tilemap[1]->set_transparent_pen(0);
state->m_tilemap[2]->set_transparent_pen(0); m_tilemap[2]->set_transparent_pen(0);
/* flipscreen n/a */ /* flipscreen n/a */
state->m_tilemap[0]->set_scrolldx(-xoffs, 0); m_tilemap[0]->set_scrolldx(-xoffs, 0);
state->m_tilemap[1]->set_scrolldx(-xoffs, 0); m_tilemap[1]->set_scrolldx(-xoffs, 0);
state->m_tilemap[2]->set_scrolldx(-xoffs, 0); m_tilemap[2]->set_scrolldx(-xoffs, 0);
state->m_tilemap[0]->set_scrolldy(-yoffs, 0); m_tilemap[0]->set_scrolldy(-yoffs, 0);
state->m_tilemap[1]->set_scrolldy(-yoffs, 0); m_tilemap[1]->set_scrolldy(-yoffs, 0);
state->m_tilemap[2]->set_scrolldy(-yoffs, 0); m_tilemap[2]->set_scrolldy(-yoffs, 0);
} }
void gcpinbal_state::video_start() void gcpinbal_state::video_start()
{ {
gcpinbal_core_vh_start(machine()); gcpinbal_core_vh_start();
} }
@ -164,10 +163,9 @@ WRITE16_MEMBER(gcpinbal_state::gcpinbal_ctrl_word_w)
****************************************************************/ ****************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs ) void gcpinbal_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs )
{ {
gcpinbal_state *state = machine.driver_data<gcpinbal_state>(); UINT16 *spriteram = m_spriteram;
UINT16 *spriteram = state->m_spriteram;
int offs, chain_pos; int offs, chain_pos;
int x, y, curx, cury; int x, y, curx, cury;
int priority = 0; int priority = 0;
@ -175,9 +173,9 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
UINT16 code; UINT16 code;
/* According to Raine, word in ioc_ram determines sprite/tile priority... */ /* According to Raine, word in ioc_ram determines sprite/tile priority... */
priority = (state->m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1; priority = (m_ioc_ram[0x68 / 2] & 0x8800) ? 0 : 1;
for (offs = state->m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8) for (offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
{ {
code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8); code = ((spriteram[offs + 5]) & 0xff) + (((spriteram[offs + 6]) & 0xff) << 8);
code &= 0x3fff; code &= 0x3fff;
@ -204,12 +202,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
for (chain_pos = chain; chain_pos >= 0; chain_pos--) for (chain_pos = chain; chain_pos >= 0; chain_pos--)
{ {
pdrawgfx_transpen(bitmap, cliprect,machine.gfx[0], pdrawgfx_transpen(bitmap, cliprect,machine().gfx[0],
code, code,
col, col,
flipx, flipy, flipx, flipy,
curx,cury, curx,cury,
machine.priority_bitmap, machine().priority_bitmap,
priority ? 0xfc : 0xf0,0); priority ? 0xfc : 0xf0,0);
code++; code++;
@ -310,7 +308,7 @@ UINT32 gcpinbal_state::screen_update_gcpinbal(screen_device &screen, bitmap_ind1
m_tilemap[layer[2]]->draw(bitmap, cliprect, 0, 4); m_tilemap[layer[2]]->draw(bitmap, cliprect, 0, 4);
draw_sprites(machine(), bitmap, cliprect, 16); draw_sprites(bitmap, cliprect, 16);
#if 0 #if 0
{ {

View File

@ -203,13 +203,12 @@ Offset: Values: Format:
------------------------------------------------------------------------ */ ------------------------------------------------------------------------ */
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect ) void ginganin_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
{ {
ginganin_state *state = machine.driver_data<ginganin_state>(); UINT16 *spriteram = m_spriteram;
UINT16 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = 0; offs < (state->m_spriteram.bytes() >> 1); offs += 4) for (offs = 0; offs < (m_spriteram.bytes() >> 1); offs += 4)
{ {
int y = spriteram[offs + 0]; int y = spriteram[offs + 0];
int x = spriteram[offs + 1]; int x = spriteram[offs + 1];
@ -221,7 +220,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const r
x = (x & 0xff) - (x & 0x100); x = (x & 0xff) - (x & 0x100);
y = (y & 0xff) - (y & 0x100); y = (y & 0xff) - (y & 0x100);
if (state->m_flipscreen) if (m_flipscreen)
{ {
x = 240 - x; x = 240 - x;
y = 240 - y; y = 240 - y;
@ -229,7 +228,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const r
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[3], drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
code & 0x3fff, code & 0x3fff,
attr >> 12, attr >> 12,
flipx, flipy, flipx, flipy,
@ -279,7 +278,7 @@ if (machine().input().code_pressed(KEYCODE_Z))
if (layers_ctrl1 & 2) if (layers_ctrl1 & 2)
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
if (layers_ctrl1 & 8) if (layers_ctrl1 & 8)
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
if (layers_ctrl1 & 4) if (layers_ctrl1 & 4)
m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0);

View File

@ -189,9 +189,8 @@ WRITE8_MEMBER(gladiatr_state::gladiatr_video_registers_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void gladiatr_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
gladiatr_state *state = machine.driver_data<gladiatr_state>();
int offs; int offs;
for (offs = 0;offs < 0x80;offs += 2) for (offs = 0;offs < 0x80;offs += 2)
@ -201,10 +200,10 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
{0x0,0x1}, {0x0,0x1},
{0x2,0x3}, {0x2,0x3},
}; };
UINT8 *src = &state->m_spriteram[offs + (state->m_sprite_buffer << 7)]; UINT8 *src = &m_spriteram[offs + (m_sprite_buffer << 7)];
int attributes = src[0x800]; int attributes = src[0x800];
int size = (attributes & 0x10) >> 4; int size = (attributes & 0x10) >> 4;
int bank = (attributes & 0x01) + ((attributes & 0x02) ? state->m_sprite_bank : 0); int bank = (attributes & 0x01) + ((attributes & 0x02) ? m_sprite_bank : 0);
int tile_number = (src[0]+256*bank); int tile_number = (src[0]+256*bank);
int sx = src[0x400+1] + 256*(src[0x801]&1) - 0x38; int sx = src[0x400+1] + 256*(src[0x801]&1) - 0x38;
int sy = 240 - src[0x400] - (size ? 16 : 0); int sy = 240 - src[0x400] - (size ? 16 : 0);
@ -213,7 +212,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
int color = src[1] & 0x1f; int color = src[1] & 0x1f;
int x,y; int x,y;
if (state->flip_screen()) if (flip_screen())
{ {
xflip = !xflip; xflip = !xflip;
yflip = !yflip; yflip = !yflip;
@ -228,7 +227,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
int t = tile_offset[ey][ex] + tile_number; int t = tile_offset[ey][ex] + tile_number;
drawgfx_transpen(bitmap,cliprect,machine.gfx[2], drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
t, t,
color, color,
xflip, yflip, xflip, yflip,
@ -243,7 +242,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
UINT32 gladiatr_state::screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 gladiatr_state::screen_update_ppking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_bg_tilemap->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(), bitmap,cliprect); draw_sprites(bitmap,cliprect);
/* the fg layer just selects the upper palette bank on underlying pixels */ /* the fg layer just selects the upper palette bank on underlying pixels */
{ {
@ -290,7 +289,7 @@ UINT32 gladiatr_state::screen_update_gladiatr(screen_device &screen, bitmap_ind1
m_fg_tilemap->set_scrolly(0, m_fg_scrolly); m_fg_tilemap->set_scrolly(0, m_fg_scrolly);
m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_bg_tilemap->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(), bitmap,cliprect); draw_sprites(bitmap,cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,0);
} }
else else

View File

@ -159,19 +159,18 @@ void glass_state::video_start()
3 | xxxxxxxx xxxxxxxx | sprite code 3 | xxxxxxxx xxxxxxxx | sprite code
*/ */
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void glass_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
glass_state *state = machine.driver_data<glass_state>();
int i; int i;
gfx_element *gfx = machine.gfx[0]; gfx_element *gfx = machine().gfx[0];
for (i = 3; i < (0x1000 - 6) / 2; i += 4) for (i = 3; i < (0x1000 - 6) / 2; i += 4)
{ {
int sx = state->m_spriteram[i + 2] & 0x01ff; int sx = m_spriteram[i + 2] & 0x01ff;
int sy = (240 - (state->m_spriteram[i] & 0x00ff)) & 0x00ff; int sy = (240 - (m_spriteram[i] & 0x00ff)) & 0x00ff;
int number = state->m_spriteram[i + 3]; int number = m_spriteram[i + 3];
int color = (state->m_spriteram[i + 2] & 0x1e00) >> 9; int color = (m_spriteram[i + 2] & 0x1e00) >> 9;
int attr = (state->m_spriteram[i] & 0xfe00) >> 9; int attr = (m_spriteram[i] & 0xfe00) >> 9;
int xflip = attr & 0x20; int xflip = attr & 0x20;
int yflip = attr & 0x40; int yflip = attr & 0x40;
@ -203,6 +202,6 @@ UINT32 glass_state::screen_update_glass(screen_device &screen, bitmap_ind16 &bit
copybitmap(bitmap, *m_screen_bitmap, 0, 0, 0x18, 0x24, cliprect); copybitmap(bitmap, *m_screen_bitmap, 0, 0, 0x18, 0x24, cliprect);
m_pant[1]->draw(bitmap, cliprect, 0, 0); m_pant[1]->draw(bitmap, cliprect, 0, 0);
m_pant[0]->draw(bitmap, cliprect, 0, 0); m_pant[0]->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -101,15 +101,14 @@ WRITE8_MEMBER(gng_state::gng_flipscreen_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gng_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
gng_state *state = machine.driver_data<gng_state>(); UINT8 *buffered_spriteram = m_spriteram->buffer();
UINT8 *buffered_spriteram = state->m_spriteram->buffer(); gfx_element *gfx = machine().gfx[2];
gfx_element *gfx = machine.gfx[2];
int offs; int offs;
for (offs = state->m_spriteram->bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4)
{ {
UINT8 attributes = buffered_spriteram[offs + 1]; UINT8 attributes = buffered_spriteram[offs + 1];
int sx = buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01); int sx = buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01);
@ -117,7 +116,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int flipx = attributes & 0x04; int flipx = attributes & 0x04;
int flipy = attributes & 0x08; int flipy = attributes & 0x08;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -136,7 +135,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
UINT32 gng_state::screen_update_gng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 gng_state::screen_update_gng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;

View File

@ -84,10 +84,9 @@ TILE_GET_INFO_MEMBER(goal92_state::get_fore_tile_info)
SET_TILE_INFO_MEMBER(region, tile, color, 0); SET_TILE_INFO_MEMBER(region, tile, color, 0);
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) void goal92_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
{ {
goal92_state *state = machine.driver_data<goal92_state>(); UINT16 *buffered_spriteram16 = m_buffered_spriteram;
UINT16 *buffered_spriteram16 = state->m_buffered_spriteram;
int offs, fx, fy, x, y, color, sprite; int offs, fx, fy, x, y, color, sprite;
for (offs = 3; offs <= 0x400 - 5; offs += 4) for (offs = 3; offs <= 0x400 - 5; offs += 4)
@ -122,7 +121,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
y = 256 - (y + 7); y = 256 - (y + 7);
drawgfx_transpen(bitmap,cliprect,machine.gfx[0], drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
sprite, sprite,
color,fx,fy,x,y,15); color,fx,fy,x,y,15);
} }
@ -162,18 +161,18 @@ UINT32 goal92_state::screen_update_goal92(screen_device &screen, bitmap_ind16 &b
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);
m_bg_layer->draw(bitmap, cliprect, 0, 0); m_bg_layer->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 2); draw_sprites(bitmap, cliprect, 2);
if (!(m_fg_bank & 0xff)) if (!(m_fg_bank & 0xff))
draw_sprites(machine(), bitmap, cliprect, 1); draw_sprites(bitmap, cliprect, 1);
m_fg_layer->draw(bitmap, cliprect, 0, 0); m_fg_layer->draw(bitmap, cliprect, 0, 0);
if(m_fg_bank & 0xff) if(m_fg_bank & 0xff)
draw_sprites(machine(), bitmap, cliprect, 1); draw_sprites(bitmap, cliprect, 1);
draw_sprites(machine(), bitmap, cliprect, 0); draw_sprites(bitmap, cliprect, 0);
draw_sprites(machine(), bitmap, cliprect, 3); draw_sprites(bitmap, cliprect, 3);
m_tx_layer->draw(bitmap, cliprect, 0, 0); m_tx_layer->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }

View File

@ -80,17 +80,16 @@ WRITE8_MEMBER(goindol_state::goindol_bg_videoram_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram ) void goindol_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int gfxbank, UINT8 *sprite_ram )
{ {
goindol_state *state = machine.driver_data<goindol_state>();
int offs, sx, sy, tile, palette; int offs, sx, sy, tile, palette;
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{ {
sx = sprite_ram[offs]; sx = sprite_ram[offs];
sy = 240 - sprite_ram[offs + 1]; sy = 240 - sprite_ram[offs + 1];
if (state->flip_screen()) if (flip_screen())
{ {
sx = 248 - sx; sx = 248 - sx;
sy = 248 - sy; sy = 248 - sy;
@ -103,17 +102,17 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
palette = sprite_ram[offs + 2] >> 3; palette = sprite_ram[offs + 2] >> 3;
drawgfx_transpen(bitmap,cliprect, drawgfx_transpen(bitmap,cliprect,
machine.gfx[gfxbank], machine().gfx[gfxbank],
tile, tile,
palette, palette,
state->flip_screen(),state->flip_screen(), flip_screen(),flip_screen(),
sx,sy, 0); sx,sy, 0);
drawgfx_transpen(bitmap,cliprect, drawgfx_transpen(bitmap,cliprect,
machine.gfx[gfxbank], machine().gfx[gfxbank],
tile+1, tile+1,
palette, palette,
state->flip_screen(),state->flip_screen(), flip_screen(),flip_screen(),
sx,sy + (state->flip_screen() ? -8 : 8), 0); sx,sy + (flip_screen() ? -8 : 8), 0);
} }
} }
} }
@ -125,7 +124,7 @@ UINT32 goindol_state::screen_update_goindol(screen_device &screen, bitmap_ind16
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 1, m_spriteram); draw_sprites(bitmap, cliprect, 1, m_spriteram);
draw_sprites(machine(), bitmap, cliprect, 0, m_spriteram2); draw_sprites(bitmap, cliprect, 0, m_spriteram2);
return 0; return 0;
} }

View File

@ -13,23 +13,22 @@ TILEMAP_MAPPER_MEMBER(gotcha_state::gotcha_tilemap_scan)
return (col & 0x1f) | (row << 5) | ((col & 0x20) << 5); return (col & 0x1f) | (row << 5) | ((col & 0x20) << 5);
} }
INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs) inline void gotcha_state::get_tile_info( tile_data &tileinfo, int tile_index ,UINT16 *vram, int color_offs)
{ {
gotcha_state *state = machine.driver_data<gotcha_state>();
UINT16 data = vram[tile_index]; UINT16 data = vram[tile_index];
int code = (data & 0x3ff) | (state->m_gfxbank[(data & 0x0c00) >> 10] << 10); int code = (data & 0x3ff) | (m_gfxbank[(data & 0x0c00) >> 10] << 10);
SET_TILE_INFO(0, code, (data >> 12) + color_offs, 0); SET_TILE_INFO_MEMBER(0, code, (data >> 12) + color_offs, 0);
} }
TILE_GET_INFO_MEMBER(gotcha_state::fg_get_tile_info) TILE_GET_INFO_MEMBER(gotcha_state::fg_get_tile_info)
{ {
get_tile_info(machine(), tileinfo, tile_index, m_fgvideoram, 0); get_tile_info(tileinfo, tile_index, m_fgvideoram, 0);
} }
TILE_GET_INFO_MEMBER(gotcha_state::bg_get_tile_info) TILE_GET_INFO_MEMBER(gotcha_state::bg_get_tile_info)
{ {
get_tile_info(machine(), tileinfo, tile_index, m_bgvideoram, 16); get_tile_info(tileinfo, tile_index, m_bgvideoram, 16);
} }

View File

@ -198,10 +198,9 @@ VIDEO_START_MEMBER(gottlieb_state,screwloo)
* *
*************************************/ *************************************/
static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect) void gottlieb_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
gottlieb_state *state = machine.driver_data<gottlieb_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
rectangle clip = cliprect; rectangle clip = cliprect;
int offs; int offs;
@ -215,15 +214,15 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
/* of level animation. */ /* of level animation. */
int sx = (spriteram[offs + 1]) - 4; int sx = (spriteram[offs + 1]) - 4;
int sy = (spriteram[offs]) - 13; int sy = (spriteram[offs]) - 13;
int code = (255 ^ spriteram[offs + 2]) + 256 * state->m_spritebank; int code = (255 ^ spriteram[offs + 2]) + 256 * m_spritebank;
if (state->flip_screen_x()) sx = 233 - sx; if (flip_screen_x()) sx = 233 - sx;
if (state->flip_screen_y()) sy = 244 - sy; if (flip_screen_y()) sy = 244 - sy;
drawgfx_transpen(bitmap, clip, drawgfx_transpen(bitmap, clip,
machine.gfx[2], machine().gfx[2],
code, 0, code, 0,
state->flip_screen_x(), state->flip_screen_y(), flip_screen_x(), flip_screen_y(),
sx,sy, 0); sx,sy, 0);
} }
} }
@ -245,7 +244,7 @@ UINT32 gottlieb_state::screen_update_gottlieb(screen_device &screen, bitmap_rgb3
bitmap.fill(machine().pens[0], cliprect); bitmap.fill(machine().pens[0], cliprect);
/* draw the sprites */ /* draw the sprites */
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
/* if the background has higher priority, render it now */ /* if the background has higher priority, render it now */
if (m_background_priority) if (m_background_priority)

View File

@ -110,12 +110,11 @@ void gotya_state::video_start()
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gotya_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(gotya_state::tilemap_scan_rows_thehand),this), 8, 8, 64, 32); m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gotya_state::get_bg_tile_info),this), tilemap_mapper_delegate(FUNC(gotya_state::tilemap_scan_rows_thehand),this), 8, 8, 64, 32);
} }
static void draw_status_row( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col ) void gotya_state::draw_status_row( bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col )
{ {
gotya_state *state = machine.driver_data<gotya_state>();
int row; int row;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 35 - sx; sx = 35 - sx;
} }
@ -124,24 +123,23 @@ static void draw_status_row( running_machine &machine, bitmap_ind16 &bitmap, con
{ {
int sy; int sy;
if (state->flip_screen()) if (flip_screen())
sy = row; sy = row;
else else
sy = 31 - row; sy = 31 - row;
drawgfx_opaque(bitmap,cliprect, drawgfx_opaque(bitmap,cliprect,
machine.gfx[0], machine().gfx[0],
state->m_videoram2[row * 32 + col], m_videoram2[row * 32 + col],
state->m_videoram2[row * 32 + col + 0x10] & 0x0f, m_videoram2[row * 32 + col + 0x10] & 0x0f,
state->flip_screen_x(), state->flip_screen_y(), flip_screen_x(), flip_screen_y(),
8 * sx, 8 * sy); 8 * sx, 8 * sy);
} }
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gotya_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
gotya_state *state = machine.driver_data<gotya_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = 2; offs < 0x0e; offs += 2) for (offs = 2; offs < 0x0e; offs += 2)
@ -151,32 +149,32 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int sx = 256 - spriteram[offs + 0x10] + (spriteram[offs + 0x01] & 0x01) * 256; int sx = 256 - spriteram[offs + 0x10] + (spriteram[offs + 0x01] & 0x01) * 256;
int sy = spriteram[offs + 0x00]; int sy = spriteram[offs + 0x00];
if (state->flip_screen()) if (flip_screen())
sy = 240 - sy; sy = 240 - sy;
drawgfx_transpen(bitmap,cliprect, drawgfx_transpen(bitmap,cliprect,
machine.gfx[1], machine().gfx[1],
code, color, code, color,
state->flip_screen_x(), state->flip_screen_y(), flip_screen_x(), flip_screen_y(),
sx, sy, 0); sx, sy, 0);
} }
} }
static void draw_status( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gotya_state::draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
draw_status_row(machine, bitmap, cliprect, 0, 1); draw_status_row(bitmap, cliprect, 0, 1);
draw_status_row(machine, bitmap, cliprect, 1, 0); draw_status_row(bitmap, cliprect, 1, 0);
draw_status_row(machine, bitmap, cliprect, 2, 2); /* these two are blank, but I dont' know if the data comes */ draw_status_row(bitmap, cliprect, 2, 2); /* these two are blank, but I dont' know if the data comes */
draw_status_row(machine, bitmap, cliprect, 33, 13); /* from RAM or 'hardcoded' into the hardware. Likely the latter */ draw_status_row(bitmap, cliprect, 33, 13); /* from RAM or 'hardcoded' into the hardware. Likely the latter */
draw_status_row(machine, bitmap, cliprect, 35, 14); draw_status_row(bitmap, cliprect, 35, 14);
draw_status_row(machine, bitmap, cliprect, 34, 15); draw_status_row(bitmap, cliprect, 34, 15);
} }
UINT32 gotya_state::screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 gotya_state::screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->set_scrollx(0, -(*m_scroll + (m_scroll_bit_8 * 256)) - 2 * 8); m_bg_tilemap->set_scrollx(0, -(*m_scroll + (m_scroll_bit_8 * 256)) - 2 * 8);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
draw_status(machine(), bitmap, cliprect); draw_status(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -108,13 +108,13 @@ void grchamp_state::video_start()
} }
#if 0 #if 0
static int collision_check(running_machine &machine, grchamp_state *state, bitmap_ind16 &bitmap, int which ) int grchamp_state::collision_check(grchamp_state *state, bitmap_ind16 &bitmap, int which )
{ {
int bgcolor = machine.pens[0]; int bgcolor = machine().pens[0];
int sprite_transp = machine.pens[0x24]; int sprite_transp = machine().pens[0x24];
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine().primary_screen->visible_area();
int y0 = 240 - state->m_cpu0_out[3]; int y0 = 240 - m_cpu0_out[3];
int x0 = 256 - state->m_cpu0_out[2]; int x0 = 256 - m_cpu0_out[2];
int x,y,sx,sy; int x,y,sx,sy;
int pixel; int pixel;
int result = 0; int result = 0;
@ -122,10 +122,10 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma
if( which==0 ) if( which==0 )
{ {
/* draw the current player sprite into a work bitmap */ /* draw the current player sprite into a work bitmap */
drawgfx_opaque( state->m_work_bitmap, drawgfx_opaque( m_work_bitmap,
state->m_work_bitmap.cliprect(), m_work_bitmap.cliprect(),
machine.gfx[4], machine().gfx[4],
state->m_cpu0_out[4]&0xf, m_cpu0_out[4]&0xf,
1, /* color */ 1, /* color */
0,0, 0,0,
0,0 ); 0,0 );
@ -135,7 +135,7 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma
{ {
for( x = 0; x<32; x++ ) for( x = 0; x<32; x++ )
{ {
pixel = state->m_work_bitmap.pix16(y, x); pixel = m_work_bitmap.pix16(y, x);
if( pixel != sprite_transp ){ if( pixel != sprite_transp ){
sx = x+x0; sx = x+x0;
sy = y+y0; sy = y+y0;
@ -158,7 +158,7 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma
return result?(1<<which):0; return result?(1<<which):0;
} }
static void draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect, int fog) void grchamp_state::draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect, int fog)
{ {
int x,y,offs; int x,y,offs;
@ -175,11 +175,11 @@ static void draw_fog(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle
} }
} }
static void draw_sprites(running_machine &machine, grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect) void grchamp_state::draw_sprites(grchamp_state *state, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
gfx_element *gfx = machine.gfx[5]; gfx_element *gfx = machine().gfx[5];
int bank = (state->m_cpu0_out[0] & 0x20) ? 0x40 : 0x00; int bank = (m_cpu0_out[0] & 0x20) ? 0x40 : 0x00;
const UINT8 *source = state->m_spriteram + 0x40; const UINT8 *source = m_spriteram + 0x40;
const UINT8 *finish = source + 0x40; const UINT8 *finish = source + 0x40;
while (source < finish) while (source < finish)
@ -201,7 +201,7 @@ static void draw_sprites(running_machine &machine, grchamp_state *state, bitmap_
#endif #endif
static void draw_objects(running_machine &machine, grchamp_state *state, int y, UINT8 *objdata) void grchamp_state::draw_objects(int y, UINT8 *objdata)
{ {
/* /*
CPU 5/7: CPU 5/7:
@ -238,16 +238,16 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y,
*/ */
const UINT8 *prom = machine.root_device().memregion("proms")->base() + 0x20; const UINT8 *prom = machine().root_device().memregion("proms")->base() + 0x20;
gfx_element *gfx; gfx_element *gfx;
int change = (state->m_cpu0_out[0] & 0x20) << 3; int change = (m_cpu0_out[0] & 0x20) << 3;
int num; int num;
/* first clear to 0; this is done as the previous scanline was scanned */ /* first clear to 0; this is done as the previous scanline was scanned */
memset(objdata, 0, 256); memset(objdata, 0, 256);
/* now draw the sprites; this is done during HBLANK */ /* now draw the sprites; this is done during HBLANK */
gfx = machine.gfx[4]; gfx = machine().gfx[4];
for (num = 0; num < 16; num++) for (num = 0; num < 16; num++)
{ {
/* /*
@ -261,23 +261,23 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y,
/* the first of the 4 bytes is the Y position; this is used to match the scanline */ /* the first of the 4 bytes is the Y position; this is used to match the scanline */
/* we match this scanline if the sum & 0xf0 == 0 */ /* we match this scanline if the sum & 0xf0 == 0 */
int sy = state->m_spriteram[0x40 + (dataoffs & ~0x20)]; int sy = m_spriteram[0x40 + (dataoffs & ~0x20)];
int dy = sy + ~y; int dy = sy + ~y;
if ((dy & 0xf0) == 0) if ((dy & 0xf0) == 0)
{ {
/* the second byte is: code is in bits 0-5, xflip in bit 6, yflip in bit 7 */ /* the second byte is: code is in bits 0-5, xflip in bit 6, yflip in bit 7 */
/* note that X flip is reversed (on purpose) */ /* note that X flip is reversed (on purpose) */
int codeflip = state->m_spriteram[0x41 + dataoffs]; int codeflip = m_spriteram[0x41 + dataoffs];
int code = (codeflip & 0x3f) + (change >> 2); int code = (codeflip & 0x3f) + (change >> 2);
int yflip = (codeflip & 0x80) ? 0x0f : 0x00; int yflip = (codeflip & 0x80) ? 0x0f : 0x00;
int xflip = (codeflip & 0x40) ? 0x0f : 0x00; int xflip = (codeflip & 0x40) ? 0x0f : 0x00;
const UINT8 *src = gfx->get_data(code) + ((dy ^ yflip) & 15) * gfx->rowbytes(); const UINT8 *src = gfx->get_data(code) + ((dy ^ yflip) & 15) * gfx->rowbytes();
/* the third byte is: color in bits 0-2 */ /* the third byte is: color in bits 0-2 */
int color = (state->m_spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2; int color = (m_spriteram[0x42 + (dataoffs & ~0x20)] & 0x07) << 2;
/* the fourth byte is the X position */ /* the fourth byte is the X position */
int sx = state->m_spriteram[0x43 + dataoffs]; int sx = m_spriteram[0x43 + dataoffs];
int x; int x;
/* draw 16 pixels */ /* draw 16 pixels */
@ -299,7 +299,7 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y,
} }
/* finally draw the text characters; this is done as we read out the object buffers */ /* finally draw the text characters; this is done as we read out the object buffers */
gfx = machine.gfx[0]; gfx = machine().gfx[0];
for (num = 0; num < 32; num++) for (num = 0; num < 32; num++)
{ {
/* /*
@ -311,10 +311,10 @@ static void draw_objects(running_machine &machine, grchamp_state *state, int y,
*/ */
int hprime = num ^ 0x1f; int hprime = num ^ 0x1f;
int dataoffs = hprime << 1; int dataoffs = hprime << 1;
int sy = state->m_spriteram[0x00 + dataoffs]; int sy = m_spriteram[0x00 + dataoffs];
int dy = sy + ~y; int dy = sy + ~y;
int color = (state->m_spriteram[0x01 + dataoffs] & 0x07) << 2; int color = (m_spriteram[0x01 + dataoffs] & 0x07) << 2;
int code = state->m_videoram[hprime | ((dy & 0xf8) << 2)] + change; int code = m_videoram[hprime | ((dy & 0xf8) << 2)] + change;
const UINT8 *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes(); const UINT8 *src = gfx->get_data(code) + (dy & 7) * gfx->rowbytes();
int x; int x;
@ -398,7 +398,7 @@ UINT32 grchamp_state::screen_update_grchamp(screen_device &screen, bitmap_rgb32
UINT8 objdata[256]; UINT8 objdata[256];
/* draw the objects for this scanline */ /* draw the objects for this scanline */
draw_objects(machine(), this, y, objdata); draw_objects(y, objdata);
/* iterate over columns */ /* iterate over columns */
for (x = cliprect.min_x; x <= cliprect.max_x; x++) for (x = cliprect.min_x; x <= cliprect.max_x; x++)

View File

@ -59,11 +59,10 @@ Heavy use is made of sprite zooming.
***************************************************************/ ***************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs) void groundfx_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs)
{ {
groundfx_state *state = machine.driver_data<groundfx_state>(); UINT32 *spriteram32 = m_spriteram;
UINT32 *spriteram32 = state->m_spriteram; UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
int offs, data, tilenum, color, flipx, flipy; int offs, data, tilenum, color, flipx, flipy;
int x, y, priority, dblsize, curx, cury; int x, y, priority, dblsize, curx, cury;
int sprites_flipscreen = 0; int sprites_flipscreen = 0;
@ -74,9 +73,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
while processing sprite ram and then draw them all at the end */ while processing sprite ram and then draw them all at the end */
struct tempsprite *sprite_ptr = state->m_spritelist; struct tempsprite *sprite_ptr = m_spritelist;
for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{ {
data = spriteram32[offs+0]; data = spriteram32[offs+0];
flipx = (data & 0x00800000) >> 23; flipx = (data & 0x00800000) >> 23;
@ -170,24 +169,24 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
} }
/* this happens only if primsks != NULL */ /* this happens only if primsks != NULL */
while (sprite_ptr != state->m_spritelist) while (sprite_ptr != m_spritelist)
{ {
const rectangle *clipper; const rectangle *clipper;
sprite_ptr--; sprite_ptr--;
if (do_hack && sprite_ptr->pri==1 && sprite_ptr->y<100) if (do_hack && sprite_ptr->pri==1 && sprite_ptr->y<100)
clipper=&state->m_hack_cliprect; clipper=&m_hack_cliprect;
else else
clipper=&cliprect; clipper=&cliprect;
pdrawgfxzoom_transpen(bitmap,*clipper,machine.gfx[sprite_ptr->gfx], pdrawgfxzoom_transpen(bitmap,*clipper,machine().gfx[sprite_ptr->gfx],
sprite_ptr->code, sprite_ptr->code,
sprite_ptr->color, sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->flipx,sprite_ptr->flipy,
sprite_ptr->x,sprite_ptr->y, sprite_ptr->x,sprite_ptr->y,
sprite_ptr->zoomx,sprite_ptr->zoomy, sprite_ptr->zoomx,sprite_ptr->zoomy,
machine.priority_bitmap,primasks[sprite_ptr->pri],0); machine().priority_bitmap,primasks[sprite_ptr->pri],0);
} }
} }
@ -252,7 +251,7 @@ UINT32 groundfx_state::screen_update_groundfx(screen_device &screen, bitmap_ind1
if (tc0480scp_long_r(tc0480scp, space, 0x20 / 4, 0xffffffff) != 0x240866) /* Stupid hack for start of race */ if (tc0480scp_long_r(tc0480scp, space, 0x20 / 4, 0xffffffff) != 0x240866) /* Stupid hack for start of race */
tc0480scp_tilemap_draw(tc0480scp, bitmap, m_hack_cliprect, layer[0], 0, 0); tc0480scp_tilemap_draw(tc0480scp, bitmap, m_hack_cliprect, layer[0], 0, 0);
draw_sprites(machine(), bitmap, cliprect, 1, 44, -574); draw_sprites(bitmap, cliprect, 1, 44, -574);
} }
else else
{ {
@ -263,7 +262,7 @@ UINT32 groundfx_state::screen_update_groundfx(screen_device &screen, bitmap_ind1
tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0); tc0100scn_tilemap_draw(tc0100scn, bitmap, cliprect, pivlayer[2], 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0, 44, -574); draw_sprites(bitmap, cliprect, 0, 44, -574);
} }
tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); /* TC0480SCP text layer */ tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 0); /* TC0480SCP text layer */

View File

@ -50,9 +50,8 @@ WRITE16_MEMBER(gstriker_state::VS920A_1_vram_w)
m_VS920A[1].tmap->mark_tile_dirty(offset); m_VS920A[1].tmap->mark_tile_dirty(offset);
} }
static void VS920A_init(running_machine &machine, int numchips) void gstriker_state::VS920A_init(int numchips)
{ {
gstriker_state *state = machine.driver_data<gstriker_state>();
int i; int i;
if (numchips > MAX_VS920A) if (numchips > MAX_VS920A)
@ -60,32 +59,32 @@ static void VS920A_init(running_machine &machine, int numchips)
for (i=0;i<numchips;i++) for (i=0;i<numchips;i++)
{ {
state->m_VS920A[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),state),TILEMAP_SCAN_ROWS,8,8,64,32); m_VS920A[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::VS920A_get_tile_info),this),TILEMAP_SCAN_ROWS,8,8,64,32);
state->m_VS920A[i].tmap->set_transparent_pen(0); m_VS920A[i].tmap->set_transparent_pen(0);
} }
} }
static tilemap_t* VS920A_get_tilemap(gstriker_state *state, int numchip) tilemap_t* gstriker_state::VS920A_get_tilemap(int numchip)
{ {
return state->m_VS920A[numchip].tmap; return m_VS920A[numchip].tmap;
} }
static void VS920A_set_pal_base(gstriker_state *state, int numchip, int pal_base) void gstriker_state::VS920A_set_pal_base(int numchip, int pal_base)
{ {
state->m_VS920A[numchip].pal_base = pal_base; m_VS920A[numchip].pal_base = pal_base;
} }
static void VS920A_set_gfx_region(gstriker_state *state, int numchip, int gfx_region) void gstriker_state::VS920A_set_gfx_region(int numchip, int gfx_region)
{ {
state->m_VS920A[numchip].gfx_region = gfx_region; m_VS920A[numchip].gfx_region = gfx_region;
} }
static void VS920A_draw(gstriker_state *state, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) void gstriker_state::VS920A_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority)
{ {
state->m_VS920A_cur_chip = &state->m_VS920A[numchip]; m_VS920A_cur_chip = &m_VS920A[numchip];
state->m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority); m_VS920A_cur_chip->tmap->draw(screen, cliprect, 0, priority);
} }
@ -207,9 +206,8 @@ TILEMAP_MAPPER_MEMBER(gstriker_state::twc94_scan)
return (row*64) + (col&63) + ((col&64)<<6); return (row*64) + (col&63) + ((col&64)<<6);
} }
static void MB60553_init(running_machine &machine, int numchips) void gstriker_state::MB60553_init(int numchips)
{ {
gstriker_state *state = machine.driver_data<gstriker_state>();
int i; int i;
if (numchips > MAX_MB60553) if (numchips > MAX_MB60553)
@ -217,32 +215,31 @@ static void MB60553_init(running_machine &machine, int numchips)
for (i=0;i<numchips;i++) for (i=0;i<numchips;i++)
{ {
state->m_MB60553[i].tmap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),state),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),state), 16,16,128,64); m_MB60553[i].tmap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(gstriker_state::MB60553_get_tile_info),this),tilemap_mapper_delegate(FUNC(gstriker_state::twc94_scan),this), 16,16,128,64);
state->m_MB60553[i].tmap->set_transparent_pen(0); m_MB60553[i].tmap->set_transparent_pen(0);
} }
} }
static void MB60553_set_pal_base(gstriker_state *state, int numchip, int pal_base) void gstriker_state::MB60553_set_pal_base(int numchip, int pal_base)
{ {
state->m_MB60553[numchip].pal_base = pal_base; m_MB60553[numchip].pal_base = pal_base;
} }
static void MB60553_set_gfx_region(gstriker_state *state, int numchip, int gfx_region) void gstriker_state::MB60553_set_gfx_region(int numchip, int gfx_region)
{ {
state->m_MB60553[numchip].gfx_region = gfx_region; m_MB60553[numchip].gfx_region = gfx_region;
} }
/* THIS IS STILL WRONG! */ /* THIS IS STILL WRONG! */
static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority) void gstriker_state::MB60553_draw(int numchip, bitmap_ind16& screen, const rectangle &cliprect, int priority)
{ {
gstriker_state *state = machine.driver_data<gstriker_state>();
int line; int line;
rectangle clip; rectangle clip;
state->m_MB60553_cur_chip = &state->m_MB60553[numchip]; m_MB60553_cur_chip = &m_MB60553[numchip];
clip.min_x = machine.primary_screen->visible_area().min_x; clip.min_x = machine().primary_screen->visible_area().min_x;
clip.max_x = machine.primary_screen->visible_area().max_x; clip.max_x = machine().primary_screen->visible_area().max_x;
for (line = 0; line < 224;line++) for (line = 0; line < 224;line++)
{ {
@ -253,19 +250,19 @@ static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& sc
UINT32 incxx,incyy; UINT32 incxx,incyy;
startx = state->m_MB60553_cur_chip->regs[0]; startx = m_MB60553_cur_chip->regs[0];
starty = state->m_MB60553_cur_chip->regs[1]; starty = m_MB60553_cur_chip->regs[1];
startx += (24<<4); // maybe not.. startx += (24<<4); // maybe not..
startx -= state->m_lineram[(line)*8+7]/2; startx -= m_lineram[(line)*8+7]/2;
incxx = state->m_lineram[(line)*8+0]<<4; incxx = m_lineram[(line)*8+0]<<4;
incyy = state->m_lineram[(line)*8+3]<<4; incyy = m_lineram[(line)*8+3]<<4;
clip.min_y = clip.max_y = line; clip.min_y = clip.max_y = line;
state->m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12, m_MB60553_cur_chip->tmap->draw_roz(screen, clip, startx<<12,starty<<12,
incxx,0,0,incyy, incxx,0,0,incyy,
1, 1,
0,priority); 0,priority);
@ -276,9 +273,9 @@ static void MB60553_draw(running_machine &machine, int numchip, bitmap_ind16& sc
} }
static tilemap_t* MB60553_get_tilemap(gstriker_state *state, int numchip) tilemap_t* gstriker_state::MB60553_get_tilemap(int numchip)
{ {
return state->m_MB60553[numchip].tmap; return m_MB60553[numchip].tmap;
} }
@ -338,11 +335,11 @@ UINT32 gstriker_state::screen_update_gstriker(screen_device &screen, bitmap_ind1
// Sandwitched screen/sprite0/score/sprite1. Surely wrong, probably // Sandwitched screen/sprite0/score/sprite1. Surely wrong, probably
// needs sprite orthogonality // needs sprite orthogonality
MB60553_draw(machine(), 0, bitmap,cliprect, 0); MB60553_draw(0, bitmap,cliprect, 0);
m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x0); m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x0);
VS920A_draw(this, 0, bitmap, cliprect, 0); VS920A_draw(0, bitmap, cliprect, 0);
m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x2); m_spr->draw_sprites(m_CG10103_vram, 0x2000, machine(), bitmap, cliprect, 0x2, 0x2);
@ -367,16 +364,16 @@ VIDEO_START_MEMBER(gstriker_state,gstriker)
// Palette bases are hardcoded, but should be probably extracted from the mixer registers // Palette bases are hardcoded, but should be probably extracted from the mixer registers
// Initalize the chip for the score plane // Initalize the chip for the score plane
VS920A_init(machine(), 1); VS920A_init(1);
VS920A_set_gfx_region(this, 0, 0); VS920A_set_gfx_region(0, 0);
VS920A_set_pal_base(this, 0, 0x30); VS920A_set_pal_base(0, 0x30);
VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); VS920A_get_tilemap(0)->set_transparent_pen(0xf);
// Initalize the chip for the screen plane // Initalize the chip for the screen plane
MB60553_init(machine(), 1); MB60553_init(1);
MB60553_set_gfx_region(this, 0, 1); MB60553_set_gfx_region(0, 1);
MB60553_set_pal_base(this, 0, 0); MB60553_set_pal_base(0, 0);
MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); MB60553_get_tilemap(0)->set_transparent_pen(0xf);
} }
VIDEO_START_MEMBER(gstriker_state,twrldc94) VIDEO_START_MEMBER(gstriker_state,twrldc94)
@ -384,16 +381,16 @@ VIDEO_START_MEMBER(gstriker_state,twrldc94)
// Palette bases are hardcoded, but should be probably extracted from the mixer registers // Palette bases are hardcoded, but should be probably extracted from the mixer registers
// Initalize the chip for the score plane // Initalize the chip for the score plane
VS920A_init(machine(), 1); VS920A_init(1);
VS920A_set_gfx_region(this, 0, 0); VS920A_set_gfx_region(0, 0);
VS920A_set_pal_base(this, 0, 0x40); VS920A_set_pal_base(0, 0x40);
VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); VS920A_get_tilemap(0)->set_transparent_pen(0xf);
// Initalize the chip for the screen plane // Initalize the chip for the screen plane
MB60553_init(machine(), 1); MB60553_init(1);
MB60553_set_gfx_region(this, 0, 1); MB60553_set_gfx_region(0, 1);
MB60553_set_pal_base(this, 0, 0x50); MB60553_set_pal_base(0, 0x50);
MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); MB60553_get_tilemap(0)->set_transparent_pen(0xf);
} }
VIDEO_START_MEMBER(gstriker_state,vgoalsoc) VIDEO_START_MEMBER(gstriker_state,vgoalsoc)
@ -401,14 +398,14 @@ VIDEO_START_MEMBER(gstriker_state,vgoalsoc)
// Palette bases are hardcoded, but should be probably extracted from the mixer registers // Palette bases are hardcoded, but should be probably extracted from the mixer registers
// Initalize the chip for the score plane // Initalize the chip for the score plane
VS920A_init(machine(), 1); VS920A_init(1);
VS920A_set_gfx_region(this, 0, 0); VS920A_set_gfx_region(0, 0);
VS920A_set_pal_base(this, 0, 0x30); VS920A_set_pal_base(0, 0x30);
VS920A_get_tilemap(this, 0)->set_transparent_pen(0xf); VS920A_get_tilemap(0)->set_transparent_pen(0xf);
// Initalize the chip for the screen plane // Initalize the chip for the screen plane
MB60553_init(machine(), 1); MB60553_init(1);
MB60553_set_gfx_region(this, 0, 1); MB60553_set_gfx_region(0, 1);
MB60553_set_pal_base(this, 0, 0x20); MB60553_set_pal_base(0, 0x20);
MB60553_get_tilemap(this, 0)->set_transparent_pen(0xf); MB60553_get_tilemap(0)->set_transparent_pen(0xf);
} }

View File

@ -158,24 +158,23 @@ void gsword_state::video_start()
8, 8, 32, 64); 8, 8, 32, 64);
} }
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void gsword_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
gsword_state *state = machine.driver_data<gsword_state>();
int offs; int offs;
for (offs = 0; offs < state->m_spritexy_ram.bytes() - 1; offs+=2) for (offs = 0; offs < m_spritexy_ram.bytes() - 1; offs+=2)
{ {
int sx,sy,flipx,flipy,spritebank,tile,color; int sx,sy,flipx,flipy,spritebank,tile,color;
if (state->m_spritexy_ram[offs]!=0xf1) if (m_spritexy_ram[offs]!=0xf1)
{ {
spritebank = 0; spritebank = 0;
tile = state->m_spritetile_ram[offs]; tile = m_spritetile_ram[offs];
color = state->m_spritetile_ram[offs+1] & 0x3f; color = m_spritetile_ram[offs+1] & 0x3f;
sy = 241-state->m_spritexy_ram[offs]; sy = 241-m_spritexy_ram[offs];
sx = state->m_spritexy_ram[offs+1]-56; sx = m_spritexy_ram[offs+1]-56;
flipx = state->m_spriteattrib_ram[offs] & 0x02; flipx = m_spriteattrib_ram[offs] & 0x02;
flipy = state->m_spriteattrib_ram[offs] & 0x01; flipy = m_spriteattrib_ram[offs] & 0x01;
// Adjust sprites that should be far far right! // Adjust sprites that should be far far right!
if (sx<0) sx+=256; if (sx<0) sx+=256;
@ -187,17 +186,17 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
tile -= 128; tile -= 128;
sy-=16; sy-=16;
} }
if (state->m_flipscreen) if (m_flipscreen)
{ {
flipx = !flipx; flipx = !flipx;
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transmask(bitmap,cliprect,machine.gfx[1+spritebank], drawgfx_transmask(bitmap,cliprect,machine().gfx[1+spritebank],
tile, tile,
color, color,
flipx,flipy, flipx,flipy,
sx,sy, sx,sy,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1+spritebank], color, 0x8f)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1+spritebank], color, 0x8f));
} }
} }
} }
@ -205,6 +204,6 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
UINT32 gsword_state::screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 gsword_state::screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -55,11 +55,10 @@ Heavy use is made of sprite zooming.
********************************************************/ ********************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs) void gunbustr_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
{ {
gunbustr_state *state = machine.driver_data<gunbustr_state>(); UINT32 *spriteram32 = m_spriteram;
UINT32 *spriteram32 = state->m_spriteram; UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
int offs, data, tilenum, color, flipx, flipy; int offs, data, tilenum, color, flipx, flipy;
int x, y, priority, dblsize, curx, cury; int x, y, priority, dblsize, curx, cury;
int sprites_flipscreen = 0; int sprites_flipscreen = 0;
@ -69,9 +68,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
/* pdrawgfx() needs us to draw sprites front to back, so we have to build a list /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
while processing sprite ram and then draw them all at the end */ while processing sprite ram and then draw them all at the end */
struct tempsprite *sprite_ptr = state->m_spritelist; struct tempsprite *sprite_ptr = m_spritelist;
for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4) for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
{ {
data = spriteram32[offs+0]; data = spriteram32[offs+0];
flipx = (data & 0x00800000) >> 23; flipx = (data & 0x00800000) >> 23;
@ -166,7 +165,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
} }
else else
{ {
drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
sprite_ptr->code, sprite_ptr->code,
sprite_ptr->color, sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->flipx,sprite_ptr->flipy,
@ -181,17 +180,17 @@ logerror("Sprite number %04x had %02x invalid chunks\n",tilenum,bad_chunks);
} }
/* this happens only if primsks != NULL */ /* this happens only if primsks != NULL */
while (sprite_ptr != state->m_spritelist) while (sprite_ptr != m_spritelist)
{ {
sprite_ptr--; sprite_ptr--;
pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx], pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
sprite_ptr->code, sprite_ptr->code,
sprite_ptr->color, sprite_ptr->color,
sprite_ptr->flipx,sprite_ptr->flipy, sprite_ptr->flipx,sprite_ptr->flipy,
sprite_ptr->x,sprite_ptr->y, sprite_ptr->x,sprite_ptr->y,
sprite_ptr->zoomx,sprite_ptr->zoomy, sprite_ptr->zoomx,sprite_ptr->zoomy,
machine.priority_bitmap,sprite_ptr->primask,0); machine().priority_bitmap,sprite_ptr->primask,0);
} }
} }
@ -235,7 +234,7 @@ UINT32 gunbustr_state::screen_update_gunbustr(screen_device &screen, bitmap_ind1
tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2); tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[2], 0, 2);
tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4); tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[3], 0, 4);
tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8); /* text layer */ tc0480scp_tilemap_draw(tc0480scp, bitmap, cliprect, layer[4], 0, 8); /* text layer */
draw_sprites(machine(), bitmap, cliprect, primasks, 48, -116); draw_sprites(bitmap, cliprect, primasks, 48, -116);
#endif #endif
return 0; return 0;
} }

View File

@ -133,13 +133,12 @@ void gunsmoke_state::video_start()
colortable_configure_tilemap_groups(machine().colortable, m_fg_tilemap, machine().gfx[0], 0x4f); colortable_configure_tilemap_groups(machine().colortable, m_fg_tilemap, machine().gfx[0], 0x4f);
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void gunsmoke_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
gunsmoke_state *state = machine.driver_data<gunsmoke_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = state->m_spriteram.bytes() - 32; offs >= 0; offs -= 32) for (offs = m_spriteram.bytes() - 32; offs >= 0; offs -= 32)
{ {
int attr = spriteram[offs + 1]; int attr = spriteram[offs + 1];
int bank = (attr & 0xc0) >> 6; int bank = (attr & 0xc0) >> 6;
@ -151,11 +150,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int sy = spriteram[offs + 2]; int sy = spriteram[offs + 2];
if (bank == 3) if (bank == 3)
bank += state->m_sprite3bank; bank += m_sprite3bank;
code += 256 * bank; code += 256 * bank;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -163,7 +162,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transpen(bitmap, cliprect, machine.gfx[2], code, color, flipx, flipy, sx, sy, 0); drawgfx_transpen(bitmap, cliprect, machine().gfx[2], code, color, flipx, flipy, sx, sy, 0);
} }
} }
@ -178,7 +177,7 @@ UINT32 gunsmoke_state::screen_update_gunsmoke(screen_device &screen, bitmap_ind1
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);
if (m_objon) if (m_objon)
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
if (m_chon) if (m_chon)
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);

View File

@ -127,21 +127,20 @@ READ8_MEMBER(gyruss_state::gyruss_scanline_r)
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx ) void gyruss_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element **gfx )
{ {
gyruss_state *state = machine.driver_data<gyruss_state>();
int offs; int offs;
for (offs = 0xbc; offs >= 0; offs -= 4) for (offs = 0xbc; offs >= 0; offs -= 4)
{ {
int x = state->m_spriteram[offs]; int x = m_spriteram[offs];
int y = 241 - state->m_spriteram[offs + 3]; int y = 241 - m_spriteram[offs + 3];
int gfx_bank = state->m_spriteram[offs + 1] & 0x01; int gfx_bank = m_spriteram[offs + 1] & 0x01;
int code = ((state->m_spriteram[offs + 2] & 0x20) << 2) | ( state->m_spriteram[offs + 1] >> 1); int code = ((m_spriteram[offs + 2] & 0x20) << 2) | ( m_spriteram[offs + 1] >> 1);
int color = state->m_spriteram[offs + 2] & 0x0f; int color = m_spriteram[offs + 2] & 0x0f;
int flip_x = ~state->m_spriteram[offs + 2] & 0x40; int flip_x = ~m_spriteram[offs + 2] & 0x40;
int flip_y = state->m_spriteram[offs + 2] & 0x80; int flip_y = m_spriteram[offs + 2] & 0x80;
drawgfx_transpen(bitmap, cliprect, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, 0); drawgfx_transpen(bitmap, cliprect, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, 0);
} }
@ -157,7 +156,7 @@ UINT32 gyruss_state::screen_update_gyruss(screen_device &screen, bitmap_ind16 &b
} }
m_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); m_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
draw_sprites(machine(), bitmap, cliprect, machine().gfx); draw_sprites(bitmap, cliprect, machine().gfx);
m_tilemap->draw(bitmap, cliprect, 0, 0); m_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;

View File

@ -410,13 +410,11 @@ ROM 3M,3L color replace table for sprite
***************************************************************************/ ***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void xevious_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
xevious_state *state = machine.driver_data<xevious_state>(); UINT8 *spriteram = m_xevious_sr3 + 0x780;
UINT8 *spriteram_2 = m_xevious_sr1 + 0x780;
UINT8 *spriteram = state->m_xevious_sr3 + 0x780; UINT8 *spriteram_3 = m_xevious_sr2 + 0x780;
UINT8 *spriteram_2 = state->m_xevious_sr1 + 0x780;
UINT8 *spriteram_3 = state->m_xevious_sr2 + 0x780;
int offs,sx,sy; int offs,sx,sy;
for (offs = 0;offs < 0x80;offs += 2) for (offs = 0;offs < 0x80;offs += 2)
@ -444,7 +442,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1); sx = spriteram_2[offs + 1] - 40 + 0x100*(spriteram_3[offs + 1] & 1);
sy = 28*8-spriteram_2[offs]-1; sy = 28*8-spriteram_2[offs]-1;
if (state->flip_screen()) if (flip_screen())
{ {
flipx = !flipx; flipx = !flipx;
flipy = !flipy; flipy = !flipy;
@ -452,41 +450,41 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
sx += 96; sx += 96;
} }
transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[bank], color, 0x80); transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[bank], color, 0x80);
if (spriteram_3[offs] & 2) /* double height (?) */ if (spriteram_3[offs] & 2) /* double height (?) */
{ {
if (spriteram_3[offs] & 1) /* double width, double height */ if (spriteram_3[offs] & 1) /* double width, double height */
{ {
code &= ~3; code &= ~3;
drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
code+3,color,flipx,flipy, code+3,color,flipx,flipy,
flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask); flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask);
drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
code+1,color,flipx,flipy, code+1,color,flipx,flipy,
flipx ? sx : sx+16,flipy ? sy : sy-16,transmask); flipx ? sx : sx+16,flipy ? sy : sy-16,transmask);
} }
code &= ~2; code &= ~2;
drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
code+2,color,flipx,flipy, code+2,color,flipx,flipy,
flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask); flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask);
drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
code,color,flipx,flipy, code,color,flipx,flipy,
flipx ? sx+16 : sx,flipy ? sy : sy-16,transmask); flipx ? sx+16 : sx,flipy ? sy : sy-16,transmask);
} }
else if (spriteram_3[offs] & 1) /* double width */ else if (spriteram_3[offs] & 1) /* double width */
{ {
code &= ~1; code &= ~1;
drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
code,color,flipx,flipy, code,color,flipx,flipy,
flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask); flipx ? sx+16 : sx,flipy ? sy-16 : sy,transmask);
drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
code+1,color,flipx,flipy, code+1,color,flipx,flipy,
flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask); flipx ? sx : sx+16,flipy ? sy-16 : sy,transmask);
} }
else /* normal */ else /* normal */
{ {
drawgfx_transmask(bitmap,cliprect,machine.gfx[bank], drawgfx_transmask(bitmap,cliprect,machine().gfx[bank],
code,color,flipx,flipy,sx,sy,transmask); code,color,flipx,flipy,sx,sy,transmask);
} }
} }
@ -497,7 +495,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
UINT32 xevious_state::screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 xevious_state::screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0,0); m_bg_tilemap->draw(bitmap, cliprect, 0,0);
draw_sprites(machine(), bitmap,cliprect); draw_sprites(bitmap,cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0,0); m_fg_tilemap->draw(bitmap, cliprect, 0,0);
return 0; return 0;
} }