Moved misc functions into driver classes and small cleanups(nw)

This commit is contained in:
Ivan Vangelista 2014-09-29 17:03:32 +00:00
parent cdc6d197ed
commit 116cfaedb3
16 changed files with 195 additions and 206 deletions

View File

@ -213,9 +213,9 @@ void n8080_state::helifire_sound_pins_changed()
{ {
UINT16 changes = ~m_curr_sound_pins & m_prev_sound_pins; UINT16 changes = ~m_curr_sound_pins & m_prev_sound_pins;
/* ((state->m_curr_sound_pins >> 0xa) & 1) not emulated */ /* ((m_curr_sound_pins >> 0xa) & 1) not emulated */
/* ((state->m_curr_sound_pins >> 0xb) & 1) not emulated */ /* ((m_curr_sound_pins >> 0xb) & 1) not emulated */
/* ((state->m_curr_sound_pins >> 0xc) & 1) not emulated */ /* ((m_curr_sound_pins >> 0xc) & 1) not emulated */
if (changes & (1 << 6)) if (changes & (1 << 6))
{ {

View File

@ -452,22 +452,22 @@ public:
INTERRUPT_GEN_MEMBER(avt_vblank_irq); INTERRUPT_GEN_MEMBER(avt_vblank_irq);
}; };
#define mc6845_h_char_total (state->m_crtc_vreg[0]) #define mc6845_h_char_total (m_crtc_vreg[0])
#define mc6845_h_display (m_crtc_vreg[1]) #define mc6845_h_display (m_crtc_vreg[1])
#define mc6845_h_sync_pos (state->m_crtc_vreg[2]) #define mc6845_h_sync_pos (m_crtc_vreg[2])
#define mc6845_sync_width (state->m_crtc_vreg[3]) #define mc6845_sync_width (m_crtc_vreg[3])
#define mc6845_v_char_total (state->m_crtc_vreg[4]) #define mc6845_v_char_total (m_crtc_vreg[4])
#define mc6845_v_total_adj (state->m_crtc_vreg[5]) #define mc6845_v_total_adj (m_crtc_vreg[5])
#define mc6845_v_display (m_crtc_vreg[6]) #define mc6845_v_display (m_crtc_vreg[6])
#define mc6845_v_sync_pos (state->m_crtc_vreg[7]) #define mc6845_v_sync_pos (m_crtc_vreg[7])
#define mc6845_mode_ctrl (state->m_crtc_vreg[8]) #define mc6845_mode_ctrl (m_crtc_vreg[8])
#define mc6845_tile_height (state->m_crtc_vreg[9]+1) #define mc6845_tile_height (m_crtc_vreg[9]+1)
#define mc6845_cursor_y_start (state->m_crtc_vreg[0x0a]) #define mc6845_cursor_y_start (m_crtc_vreg[0x0a])
#define mc6845_cursor_y_end (state->m_crtc_vreg[0x0b]) #define mc6845_cursor_y_end (m_crtc_vreg[0x0b])
#define mc6845_start_addr (((state->m_crtc_vreg[0x0c]<<8) & 0x3f00) | (state->m_crtc_vreg[0x0d] & 0xff)) #define mc6845_start_addr (((m_crtc_vreg[0x0c]<<8) & 0x3f00) | (m_crtc_vreg[0x0d] & 0xff))
#define mc6845_cursor_addr (((state->m_crtc_vreg[0x0e]<<8) & 0x3f00) | (state->m_crtc_vreg[0x0f] & 0xff)) #define mc6845_cursor_addr (((m_crtc_vreg[0x0e]<<8) & 0x3f00) | (m_crtc_vreg[0x0f] & 0xff))
#define mc6845_light_pen_addr (((state->m_crtc_vreg[0x10]<<8) & 0x3f00) | (state->m_crtc_vreg[0x11] & 0xff)) #define mc6845_light_pen_addr (((m_crtc_vreg[0x10]<<8) & 0x3f00) | (m_crtc_vreg[0x11] & 0xff))
#define mc6845_update_addr (((state->m_crtc_vreg[0x12]<<8) & 0x3f00) | (state->m_crtc_vreg[0x13] & 0xff)) #define mc6845_update_addr (((m_crtc_vreg[0x12]<<8) & 0x3f00) | (m_crtc_vreg[0x13] & 0xff))
/********************************************* /*********************************************

View File

@ -638,11 +638,10 @@ ADDRESS_MAP_END
Koro Koro Quest Koro Koro Quest
***************************************************************************/ ***************************************************************************/
static void show_leds(running_machine &machine) void cave_state::show_leds()
{ {
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
// cave_state *state = machine.driver_data<cave_state>(); // popmessage("led %04X eep %02X", m_leds[0], (m_leds[1] >> 8) & ~0x70);
// popmessage("led %04X eep %02X", state->m_leds[0], (state->m_leds[1] >> 8) & ~0x70);
#endif #endif
} }
@ -666,7 +665,7 @@ WRITE16_MEMBER(cave_state::korokoro_leds_w)
set_led_status(machine(), 7, data & 0x0002); set_led_status(machine(), 7, data & 0x0002);
set_led_status(machine(), 8, data & 0x0001); set_led_status(machine(), 8, data & 0x0001);
show_leds(machine()); show_leds();
} }
@ -676,7 +675,7 @@ WRITE16_MEMBER(cave_state::korokoro_eeprom_msb_w)
{ {
logerror("%s: Unknown EEPROM bit written %04X\n",machine().describe_context(),data); logerror("%s: Unknown EEPROM bit written %04X\n",machine().describe_context(),data);
COMBINE_DATA(&m_leds[1]); COMBINE_DATA(&m_leds[1]);
show_leds(machine()); show_leds();
} }
if (ACCESSING_BITS_8_15) // even address if (ACCESSING_BITS_8_15) // even address
@ -924,10 +923,9 @@ READ16_MEMBER(cave_state::pwrinst2_eeprom_r)
return ~8 + ((m_eeprom->do_read() & 1) ? 8 : 0); return ~8 + ((m_eeprom->do_read() & 1) ? 8 : 0);
} }
INLINE void vctrl_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX) inline void cave_state::vctrl_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX)
{ {
cave_state *state = space.machine().driver_data<cave_state>(); UINT16 *VCTRL = m_vctrl[GFX];
UINT16 *VCTRL = state->m_vctrl[GFX];
if (offset == 4 / 2) if (offset == 4 / 2)
{ {
switch (data & 0x000f) switch (data & 0x000f)
@ -4665,10 +4663,10 @@ ROM_END
/* Tiles are 6 bit, 4 bits stored in one rom, 2 bits in the other. /* Tiles are 6 bit, 4 bits stored in one rom, 2 bits in the other.
Expand the 2 bit part into a 4 bit layout, so we can decode it */ Expand the 2 bit part into a 4 bit layout, so we can decode it */
static void sailormn_unpack_tiles( running_machine &machine, const char *region ) void cave_state::sailormn_unpack_tiles( const char *region )
{ {
const UINT32 len = machine.root_device().memregion(region)->bytes(); const UINT32 len = memregion(region)->bytes();
UINT8 *rgn = machine.root_device().memregion(region)->base(); UINT8 *rgn = memregion(region)->base();
UINT8 *src = rgn + (len/4)*3 - 1; UINT8 *src = rgn + (len/4)*3 - 1;
UINT8 *dst = rgn + (len/4)*4 - 2; UINT8 *dst = rgn + (len/4)*4 - 2;
@ -4684,22 +4682,20 @@ static void sailormn_unpack_tiles( running_machine &machine, const char *region
} }
} }
static void init_cave(running_machine &machine) void cave_state::init_cave()
{ {
cave_state *state = machine.driver_data<cave_state>(); m_spritetype[0] = 0; // Normal sprites
m_kludge = 0;
m_time_vblank_irq = 100;
state->m_spritetype[0] = 0; // Normal sprites m_irq_level = 1;
state->m_kludge = 0;
state->m_time_vblank_irq = 100;
state->m_irq_level = 1;
} }
DRIVER_INIT_MEMBER(cave_state,agallet) DRIVER_INIT_MEMBER(cave_state,agallet)
{ {
UINT8 *ROM = memregion("audiocpu")->base(); UINT8 *ROM = memregion("audiocpu")->base();
init_cave(machine()); init_cave();
membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000); membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000);
@ -4711,14 +4707,14 @@ DRIVER_INIT_MEMBER(cave_state,agallet)
membank("oki2bank1")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000); membank("oki2bank1")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
membank("oki2bank2")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000); membank("oki2bank2")->configure_entries(0, 0x10, &ROM[0x00000], 0x20000);
sailormn_unpack_tiles(machine(), "layer2"); sailormn_unpack_tiles("layer2");
unpack_sprites("sprites0"); unpack_sprites("sprites0");
} }
DRIVER_INIT_MEMBER(cave_state,dfeveron) DRIVER_INIT_MEMBER(cave_state,dfeveron)
{ {
init_cave(machine()); init_cave();
unpack_sprites("sprites0"); unpack_sprites("sprites0");
m_kludge = 2; m_kludge = 2;
@ -4726,7 +4722,7 @@ DRIVER_INIT_MEMBER(cave_state,dfeveron)
DRIVER_INIT_MEMBER(cave_state,feversos) DRIVER_INIT_MEMBER(cave_state,feversos)
{ {
init_cave(machine()); init_cave();
unpack_sprites("sprites0"); unpack_sprites("sprites0");
m_kludge = 2; m_kludge = 2;
@ -4734,7 +4730,7 @@ DRIVER_INIT_MEMBER(cave_state,feversos)
DRIVER_INIT_MEMBER(cave_state,ddonpach) DRIVER_INIT_MEMBER(cave_state,ddonpach)
{ {
init_cave(machine()); init_cave();
ddonpach_unpack_sprites("sprites0"); ddonpach_unpack_sprites("sprites0");
m_spritetype[0] = 1; // "different" sprites (no zooming?) m_spritetype[0] = 1; // "different" sprites (no zooming?)
@ -4743,7 +4739,7 @@ DRIVER_INIT_MEMBER(cave_state,ddonpach)
DRIVER_INIT_MEMBER(cave_state,donpachi) DRIVER_INIT_MEMBER(cave_state,donpachi)
{ {
init_cave(machine()); init_cave();
ddonpach_unpack_sprites("sprites0"); ddonpach_unpack_sprites("sprites0");
m_spritetype[0] = 1; // "different" sprites (no zooming?) m_spritetype[0] = 1; // "different" sprites (no zooming?)
@ -4753,7 +4749,7 @@ DRIVER_INIT_MEMBER(cave_state,donpachi)
DRIVER_INIT_MEMBER(cave_state,esprade) DRIVER_INIT_MEMBER(cave_state,esprade)
{ {
init_cave(machine()); init_cave();
esprade_unpack_sprites("sprites0"); esprade_unpack_sprites("sprites0");
m_time_vblank_irq = 2000; /**/ m_time_vblank_irq = 2000; /**/
@ -4768,7 +4764,7 @@ DRIVER_INIT_MEMBER(cave_state,esprade)
DRIVER_INIT_MEMBER(cave_state,gaia) DRIVER_INIT_MEMBER(cave_state,gaia)
{ {
init_cave(machine()); init_cave();
/* No EEPROM */ /* No EEPROM */
@ -4779,7 +4775,7 @@ DRIVER_INIT_MEMBER(cave_state,gaia)
DRIVER_INIT_MEMBER(cave_state,guwange) DRIVER_INIT_MEMBER(cave_state,guwange)
{ {
init_cave(machine()); init_cave();
esprade_unpack_sprites("sprites0"); esprade_unpack_sprites("sprites0");
m_time_vblank_irq = 2000; /**/ m_time_vblank_irq = 2000; /**/
@ -4789,7 +4785,7 @@ DRIVER_INIT_MEMBER(cave_state,hotdogst)
{ {
UINT8 *ROM = memregion("audiocpu")->base(); UINT8 *ROM = memregion("audiocpu")->base();
init_cave(machine()); init_cave();
membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000); membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000);
@ -4808,7 +4804,7 @@ DRIVER_INIT_MEMBER(cave_state,mazinger)
UINT8 *src = memregion("sprites0")->base(); UINT8 *src = memregion("sprites0")->base();
int len = memregion("sprites0")->bytes(); int len = memregion("sprites0")->bytes();
init_cave(machine()); init_cave();
membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000); membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000);
@ -4835,7 +4831,7 @@ DRIVER_INIT_MEMBER(cave_state,metmqstr)
{ {
UINT8 *ROM = memregion("audiocpu")->base(); UINT8 *ROM = memregion("audiocpu")->base();
init_cave(machine()); init_cave();
membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000); membank("z80bank")->configure_entries(0, 0x10, &ROM[0x00000], 0x4000);
@ -4855,7 +4851,7 @@ DRIVER_INIT_MEMBER(cave_state,metmqstr)
DRIVER_INIT_MEMBER(cave_state,ppsatan) DRIVER_INIT_MEMBER(cave_state,ppsatan)
{ {
init_cave(machine()); init_cave();
unpack_sprites("sprites0"); unpack_sprites("sprites0");
unpack_sprites("sprites1"); unpack_sprites("sprites1");
@ -4875,7 +4871,7 @@ DRIVER_INIT_MEMBER(cave_state,pwrinst2j)
int len = memregion("sprites0")->bytes(); int len = memregion("sprites0")->bytes();
int i, j; int i, j;
init_cave(machine()); init_cave();
membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000); membank("z80bank")->configure_entries(0, 8, &ROM[0x00000], 0x4000);
@ -4919,7 +4915,7 @@ DRIVER_INIT_MEMBER(cave_state,sailormn)
UINT8 *src = memregion("sprites0")->base(); UINT8 *src = memregion("sprites0")->base();
int len = memregion("sprites0")->bytes(); int len = memregion("sprites0")->bytes();
init_cave(machine()); init_cave();
membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000); membank("z80bank")->configure_entries(0, 0x20, &ROM[0x00000], 0x4000);
@ -4940,7 +4936,7 @@ DRIVER_INIT_MEMBER(cave_state,sailormn)
memcpy(src, buffer, len); memcpy(src, buffer, len);
} }
sailormn_unpack_tiles( machine(), "layer2" ); sailormn_unpack_tiles("layer2");
unpack_sprites("sprites0"); unpack_sprites("sprites0");
m_spritetype[0] = 2; // Normal sprites with different position handling m_spritetype[0] = 2; // Normal sprites with different position handling
@ -4953,7 +4949,7 @@ DRIVER_INIT_MEMBER(cave_state,sailormn)
DRIVER_INIT_MEMBER(cave_state,tjumpman) DRIVER_INIT_MEMBER(cave_state,tjumpman)
{ {
init_cave(machine()); init_cave();
unpack_sprites("sprites0"); unpack_sprites("sprites0");
m_spritetype[0] = 2; // Normal sprites with different position handling m_spritetype[0] = 2; // Normal sprites with different position handling
@ -4966,7 +4962,7 @@ DRIVER_INIT_MEMBER(cave_state,tjumpman)
DRIVER_INIT_MEMBER(cave_state,uopoko) DRIVER_INIT_MEMBER(cave_state,uopoko)
{ {
init_cave(machine()); init_cave();
unpack_sprites("sprites0"); unpack_sprites("sprites0");
m_kludge = 2; m_kludge = 2;
@ -4975,7 +4971,7 @@ DRIVER_INIT_MEMBER(cave_state,uopoko)
DRIVER_INIT_MEMBER(cave_state,korokoro) DRIVER_INIT_MEMBER(cave_state,korokoro)
{ {
init_cave(machine()); init_cave();
m_irq_level = 2; m_irq_level = 2;

View File

@ -387,13 +387,13 @@ public:
void draw_line(const rectangle &visarea, vertex_t &v1, vertex_t &v2); void draw_line(const rectangle &visarea, vertex_t &v1, vertex_t &v2);
void gfx_init(); void gfx_init();
void gfx_exit(running_machine &machine); void gfx_exit();
void gfx_reset(running_machine &machine); void gfx_reset();
void gfx_fifo_exec(running_machine &machine); void gfx_fifo_exec();
UINT32 gfx_read_gram(UINT32 address); UINT32 gfx_read_gram(UINT32 address);
void gfx_write_gram(UINT32 address, UINT32 mask, UINT32 data); void gfx_write_gram(UINT32 address, UINT32 mask, UINT32 data);
UINT64 gfx_read_reg(running_machine &machine); UINT64 gfx_read_reg();
void gfx_write_reg(running_machine &machine, UINT64 data); void gfx_write_reg(UINT64 data);
void display(bitmap_rgb32 *bitmap, const rectangle &cliprect); void display(bitmap_rgb32 *bitmap, const rectangle &cliprect);
inline rgb_t texture_fetch(UINT32 *texture, int u, int v, int width, int format); inline rgb_t texture_fetch(UINT32 *texture, int u, int v, int width, int format);
@ -998,7 +998,7 @@ void cobra_renderer::draw_line(const rectangle &visarea, vertex_t &v1, vertex_t
void cobra_state::cobra_video_exit() void cobra_state::cobra_video_exit()
{ {
m_renderer->gfx_exit(machine()); m_renderer->gfx_exit();
} }
void cobra_state::video_start() void cobra_state::video_start()
@ -2032,7 +2032,7 @@ void cobra_renderer::gfx_init()
m_zbuffer->fill(*(int*)&zvalue, visarea); m_zbuffer->fill(*(int*)&zvalue, visarea);
} }
void cobra_renderer::gfx_exit(running_machine &machine) void cobra_renderer::gfx_exit()
{ {
/* /*
FILE *file; FILE *file;
@ -2048,9 +2048,9 @@ void cobra_renderer::gfx_exit(running_machine &machine)
*/ */
} }
void cobra_renderer::gfx_reset(running_machine &machine) void cobra_renderer::gfx_reset()
{ {
cobra_state *cobra = machine.driver_data<cobra_state>(); cobra_state *cobra = machine().driver_data<cobra_state>();
cobra->m_gfx_re_status = RE_STATUS_IDLE; cobra->m_gfx_re_status = RE_STATUS_IDLE;
} }
@ -2125,12 +2125,12 @@ void cobra_renderer::gfx_write_gram(UINT32 address, UINT32 mask, UINT32 data)
m_gfx_gram[address/4] |= data & mask; m_gfx_gram[address/4] |= data & mask;
} }
UINT64 cobra_renderer::gfx_read_reg(running_machine &machine) UINT64 cobra_renderer::gfx_read_reg()
{ {
return m_gfx_register[m_gfx_register_select]; return m_gfx_register[m_gfx_register_select];
} }
void cobra_renderer::gfx_write_reg(running_machine &machine, UINT64 data) void cobra_renderer::gfx_write_reg(UINT64 data)
{ {
switch (m_gfx_register_select) switch (m_gfx_register_select)
{ {
@ -2150,9 +2150,9 @@ void cobra_renderer::gfx_write_reg(running_machine &machine, UINT64 data)
m_gfx_register[m_gfx_register_select] = data; m_gfx_register[m_gfx_register_select] = data;
} }
void cobra_renderer::gfx_fifo_exec(running_machine &machine) void cobra_renderer::gfx_fifo_exec()
{ {
cobra_state *cobra = machine.driver_data<cobra_state>(); cobra_state *cobra = machine().driver_data<cobra_state>();
if (cobra->m_gfx_fifo_loopback != 0) if (cobra->m_gfx_fifo_loopback != 0)
return; return;
@ -2230,7 +2230,7 @@ void cobra_renderer::gfx_fifo_exec(running_machine &machine)
// 64-bit registers, top 32-bits in word 2, low 32-bit in word 3 // 64-bit registers, top 32-bits in word 2, low 32-bit in word 3
printf("GFX: register write %08X: %08X %08X\n", m_gfx_register_select, w[2], w[3]); printf("GFX: register write %08X: %08X %08X\n", m_gfx_register_select, w[2], w[3]);
gfx_write_reg(machine, ((UINT64)(w[2]) << 32) | w[3]); gfx_write_reg(((UINT64)(w[2]) << 32) | w[3]);
} }
else if (w2 == 0x10521000) else if (w2 == 0x10521000)
{ {
@ -2832,7 +2832,7 @@ READ64_MEMBER(cobra_state::gfx_fifo_r)
{ {
UINT64 r = 0; UINT64 r = 0;
m_renderer->gfx_fifo_exec(space.machine()); m_renderer->gfx_fifo_exec();
if (ACCESSING_BITS_32_63) if (ACCESSING_BITS_32_63)
{ {
@ -2958,7 +2958,7 @@ WRITE64_MEMBER(cobra_state::gfx_buf_w)
// printf("prc_read %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), activecpu_get_pc()); // printf("prc_read %08X%08X at %08X\n", (UINT32)(data >> 32), (UINT32)(data), activecpu_get_pc());
m_renderer->gfx_fifo_exec(space.machine()); m_renderer->gfx_fifo_exec();
if (data == U64(0x00a0000110500018)) if (data == U64(0x00a0000110500018))
{ {
@ -2966,7 +2966,7 @@ WRITE64_MEMBER(cobra_state::gfx_buf_w)
// reads back the register selected by gfx register select // reads back the register selected by gfx register select
UINT64 regdata = m_renderer->gfx_read_reg(space.machine()); UINT64 regdata = m_renderer->gfx_read_reg();
m_gfxfifo_out->push(&space.device(), (UINT32)(regdata >> 32)); m_gfxfifo_out->push(&space.device(), (UINT32)(regdata >> 32));
m_gfxfifo_out->push(&space.device(), (UINT32)(regdata)); m_gfxfifo_out->push(&space.device(), (UINT32)(regdata));
@ -3012,7 +3012,7 @@ static void gfx_cpu_dc_store(device_t *device, UINT32 address)
fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >> 32) | i); fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >> 32) | i);
fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >> 0) | i); fifo_in->push(device, (UINT32)(cobra->m_gfx_fifo_mem[a+3] >> 0) | i);
cobra->m_renderer->gfx_fifo_exec(device->machine()); cobra->m_renderer->gfx_fifo_exec();
} }
else else
{ {
@ -3150,7 +3150,7 @@ void cobra_state::machine_reset()
identify_device[51] = 0x0200; /* 51: PIO data transfer cycle timing mode */ identify_device[51] = 0x0200; /* 51: PIO data transfer cycle timing mode */
identify_device[67] = 0x01e0; /* 67: minimum PIO transfer cycle time without flow control */ identify_device[67] = 0x01e0; /* 67: minimum PIO transfer cycle time without flow control */
m_renderer->gfx_reset(machine()); m_renderer->gfx_reset();
m_sound_dma_ptr = 0; m_sound_dma_ptr = 0;

View File

@ -1106,19 +1106,17 @@ ROM_END
* *
*************************************/ *************************************/
static void register_state_save(running_machine &machine) void coolpool_state::register_state_save()
{ {
coolpool_state *state = machine.driver_data<coolpool_state>(); save_item(NAME(m_oldx));
save_item(NAME(m_oldy));
save_item(NAME(m_result));
save_item(NAME(m_lastresult));
state->save_item(NAME(state->m_oldx)); save_item(NAME(m_cmd_pending));
state->save_item(NAME(state->m_oldy)); save_item(NAME(m_iop_cmd));
state->save_item(NAME(state->m_result)); save_item(NAME(m_iop_answer));
state->save_item(NAME(state->m_lastresult)); save_item(NAME(m_iop_romaddr));
state->save_item(NAME(state->m_cmd_pending));
state->save_item(NAME(state->m_iop_cmd));
state->save_item(NAME(state->m_iop_answer));
state->save_item(NAME(state->m_iop_romaddr));
} }
@ -1127,14 +1125,14 @@ DRIVER_INIT_MEMBER(coolpool_state,amerdart)
{ {
m_lastresult = 0xffff; m_lastresult = 0xffff;
register_state_save(machine()); register_state_save();
} }
DRIVER_INIT_MEMBER(coolpool_state,coolpool) DRIVER_INIT_MEMBER(coolpool_state,coolpool)
{ {
m_dsp->space(AS_IO).install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this)); m_dsp->space(AS_IO).install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this));
register_state_save(machine()); register_state_save();
} }
@ -1178,7 +1176,7 @@ DRIVER_INIT_MEMBER(coolpool_state,9ballsht)
rom[a+1] = tmp; rom[a+1] = tmp;
} }
register_state_save(machine()); register_state_save();
} }

View File

@ -446,7 +446,7 @@ INTERRUPT_GEN_MEMBER(galaxian_state::fakechange_interrupt_gen)
{ {
m_tenspot_current_game++; m_tenspot_current_game++;
m_tenspot_current_game%=10; m_tenspot_current_game%=10;
tenspot_set_game_bank(machine(), m_tenspot_current_game, 1); tenspot_set_game_bank(m_tenspot_current_game, 1);
m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE); m_maincpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
} }
} }
@ -5972,7 +5972,7 @@ READ8_MEMBER(galaxian_state::tenspot_dsw_read)
} }
void galaxian_state::tenspot_set_game_bank(running_machine& machine, int bank, int from_game) void galaxian_state::tenspot_set_game_bank(int bank, int from_game)
{ {
char tmp[64]; char tmp[64];
UINT8* srcregion; UINT8* srcregion;
@ -5980,15 +5980,15 @@ void galaxian_state::tenspot_set_game_bank(running_machine& machine, int bank, i
int x; int x;
sprintf(tmp,"game_%d_cpu", bank); sprintf(tmp,"game_%d_cpu", bank);
srcregion = machine.root_device().memregion(tmp)->base(); srcregion = memregion(tmp)->base();
dstregion = machine.root_device().memregion("maincpu")->base(); dstregion = memregion("maincpu")->base();
memcpy(dstregion, srcregion, 0x4000); memcpy(dstregion, srcregion, 0x4000);
sprintf(tmp,"game_%d_temp", bank); sprintf(tmp,"game_%d_temp", bank);
srcregion = machine.root_device().memregion(tmp)->base(); srcregion = memregion(tmp)->base();
dstregion = machine.root_device().memregion("gfx1")->base(); dstregion = memregion("gfx1")->base();
memcpy(dstregion, srcregion, 0x2000); memcpy(dstregion, srcregion, 0x2000);
dstregion = machine.root_device().memregion("gfx2")->base(); dstregion = memregion("gfx2")->base();
memcpy(dstregion, srcregion, 0x2000); memcpy(dstregion, srcregion, 0x2000);
if (from_game) if (from_game)
@ -6005,8 +6005,8 @@ void galaxian_state::tenspot_set_game_bank(running_machine& machine, int bank, i
} }
sprintf(tmp,"game_%d_prom", bank); sprintf(tmp,"game_%d_prom", bank);
srcregion = machine.root_device().memregion(tmp)->base(); srcregion = memregion(tmp)->base();
dstregion = machine.root_device().memregion("proms")->base(); dstregion = memregion("proms")->base();
memcpy(dstregion, srcregion, 0x20); memcpy(dstregion, srcregion, 0x20);
PALETTE_INIT_NAME(galaxian)(m_palette); PALETTE_INIT_NAME(galaxian)(m_palette);
@ -6032,7 +6032,7 @@ DRIVER_INIT_MEMBER(galaxian_state,tenspot)
m_tenspot_current_game = 0; m_tenspot_current_game = 0;
tenspot_set_game_bank(machine(), m_tenspot_current_game, 0); tenspot_set_game_bank(m_tenspot_current_game, 0);
space.install_read_handler(0x7000, 0x7000, read8_delegate(FUNC(galaxian_state::tenspot_dsw_read),this)); space.install_read_handler(0x7000, 0x7000, read8_delegate(FUNC(galaxian_state::tenspot_dsw_read),this));
} }

View File

@ -472,14 +472,13 @@ WRITE32_MEMBER(midzeus_state::analog_w)
* *
*************************************/ *************************************/
static void update_gun_irq(running_machine &machine) void midzeus_state::update_gun_irq()
{ {
midzeus_state *state = machine.driver_data<midzeus_state>();
/* low 2 bits of gun_control seem to enable IRQs */ /* low 2 bits of gun_control seem to enable IRQs */
if (gun_irq_state & gun_control & 0x03) if (gun_irq_state & gun_control & 0x03)
state->m_maincpu->set_input_line(3, ASSERT_LINE); m_maincpu->set_input_line(3, ASSERT_LINE);
else else
state->m_maincpu->set_input_line(3, CLEAR_LINE); m_maincpu->set_input_line(3, CLEAR_LINE);
} }
@ -490,7 +489,7 @@ TIMER_CALLBACK_MEMBER(midzeus_state::invasn_gun_callback)
/* set the appropriate IRQ in the internal gun control and update */ /* set the appropriate IRQ in the internal gun control and update */
gun_irq_state |= 0x01 << player; gun_irq_state |= 0x01 << player;
update_gun_irq(machine()); update_gun_irq();
/* generate another interrupt on the next scanline while we are within the BEAM_DY */ /* generate another interrupt on the next scanline while we are within the BEAM_DY */
beamy++; beamy++;
@ -509,7 +508,7 @@ WRITE32_MEMBER(midzeus_state::invasn_gun_w)
/* bits 0-1 enable IRQs (?) */ /* bits 0-1 enable IRQs (?) */
/* bits 2-3 reset IRQ states */ /* bits 2-3 reset IRQ states */
gun_irq_state &= ~((gun_control >> 2) & 3); gun_irq_state &= ~((gun_control >> 2) & 3);
update_gun_irq(machine()); update_gun_irq();
for (player = 0; player < 2; player++) for (player = 0; player < 2; player++)
{ {

View File

@ -529,16 +529,6 @@ orunners: Interleaved with the dj and << >> buttons is the data the drives the
/*************************************
*
* Prototypes
*
*************************************/
static void signal_sound_irq(running_machine &machine, int which);
/************************************* /*************************************
* *
* Machine init * Machine init
@ -659,7 +649,7 @@ void segas32_state::int_control_w(address_space &space, int offset, UINT8 data)
case 13: case 13:
case 14: case 14:
case 15: /* signal IRQ to sound CPU */ case 15: /* signal IRQ to sound CPU */
signal_sound_irq(machine(),SOUND_IRQ_V60); signal_sound_irq(SOUND_IRQ_V60);
break; break;
} }
} }
@ -1216,27 +1206,22 @@ void segas32_state::update_sound_irq_state()
} }
static void signal_sound_irq(running_machine &machine, int which) void segas32_state::signal_sound_irq(int which)
{ {
segas32_state *state = machine.driver_data<segas32_state>();
int i;
/* see if this interrupt input is mapped to any vectors; if so, mark them */ /* see if this interrupt input is mapped to any vectors; if so, mark them */
for (i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
if (state->m_sound_irq_control[i] == which) if (m_sound_irq_control[i] == which)
state->m_sound_irq_input |= 1 << i; m_sound_irq_input |= 1 << i;
state->update_sound_irq_state(); update_sound_irq_state();
} }
static void clear_sound_irq(running_machine &machine, int which) void segas32_state::clear_sound_irq(int which)
{ {
segas32_state *state = machine.driver_data<segas32_state>(); for (int i = 0; i < 3; i++)
int i; if (m_sound_irq_control[i] == which)
for (i = 0; i < 3; i++) m_sound_irq_input &= ~(1 << i);
if (state->m_sound_irq_control[i] == which) update_sound_irq_state();
state->m_sound_irq_input &= ~(1 << i);
state->update_sound_irq_state();
} }
@ -1265,9 +1250,9 @@ WRITE8_MEMBER(segas32_state::sound_int_control_hi_w)
WRITE_LINE_MEMBER(segas32_state::ym3438_irq_handler) WRITE_LINE_MEMBER(segas32_state::ym3438_irq_handler)
{ {
if (state) if (state)
signal_sound_irq(machine(), SOUND_IRQ_YM3438); signal_sound_irq(SOUND_IRQ_YM3438);
else else
clear_sound_irq(machine(), SOUND_IRQ_YM3438); clear_sound_irq(SOUND_IRQ_YM3438);
} }

View File

@ -608,11 +608,11 @@ public:
DECLARE_READ16_MEMBER(tlcs_ide1_r); DECLARE_READ16_MEMBER(tlcs_ide1_r);
DECLARE_WRITE_LINE_MEMBER(ide_interrupt); DECLARE_WRITE_LINE_MEMBER(ide_interrupt);
void taitotz_exit(); void taitotz_exit();
void draw_tile(taitotz_state *state, UINT32 pos, UINT32 tile); void draw_tile(UINT32 pos, UINT32 tile);
UINT32 video_mem_r(taitotz_state *state, UINT32 address); UINT32 video_mem_r(UINT32 address);
void video_mem_w(taitotz_state *state, UINT32 address, UINT32 data); void video_mem_w(UINT32 address, UINT32 data);
UINT32 video_reg_r(taitotz_state *state, UINT32 reg); UINT32 video_reg_r(UINT32 reg);
void video_reg_w(taitotz_state *state, UINT32 reg, UINT32 data); void video_reg_w(UINT32 reg, UINT32 data);
void init_taitotz_152(); void init_taitotz_152();
void init_taitotz_111a(); void init_taitotz_111a();
}; };
@ -634,8 +634,8 @@ public:
} }
void set_fb(bitmap_rgb32 *fb) { m_fb = fb; } void set_fb(bitmap_rgb32 *fb) { m_fb = fb; }
void render_displaylist(running_machine &machine, const rectangle &cliprect); void render_displaylist(const rectangle &cliprect);
void draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha); void draw_object(UINT32 address, float scale, UINT8 alpha);
float line_plane_intersection(const vertex_t *v1, const vertex_t *v2, PLANE cp); float line_plane_intersection(const vertex_t *v1, const vertex_t *v2, PLANE cp);
int clip_polygon(const vertex_t *v, int num_vertices, PLANE cp, vertex_t *vout); int clip_polygon(const vertex_t *v, int num_vertices, PLANE cp, vertex_t *vout);
void setup_viewport(int x, int y, int width, int height, int center_x, int center_y); void setup_viewport(int x, int y, int width, int height, int center_x, int center_y);
@ -1152,7 +1152,7 @@ int taitotz_renderer::clip_polygon(const vertex_t *v, int num_vertices, PLANE cp
return clip_verts; return clip_verts;
} }
void taitotz_renderer::draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha) void taitotz_renderer::draw_object(UINT32 address, float scale, UINT8 alpha)
{ {
const rectangle& visarea = m_state.m_screen->visible_area(); const rectangle& visarea = m_state.m_screen->visible_area();
@ -1336,7 +1336,7 @@ void taitotz_renderer::setup_viewport(int x, int y, int width, int height, int c
m_clip_plane[4].d = 0.1f; m_clip_plane[4].d = 0.1f;
} }
void taitotz_renderer::render_displaylist(running_machine &machine, const rectangle &cliprect) void taitotz_renderer::render_displaylist(const rectangle &cliprect)
{ {
float zvalue = 0;//ZBUFFER_MAX; float zvalue = 0;//ZBUFFER_MAX;
m_zbuffer->fill(*(int*)&zvalue, cliprect); m_zbuffer->fill(*(int*)&zvalue, cliprect);
@ -1405,7 +1405,7 @@ void taitotz_renderer::render_displaylist(running_machine &machine, const rectan
UINT32 alpha = w[2]; UINT32 alpha = w[2];
draw_object(machine, w[0] & 0x1fffff, scale, alpha); draw_object(w[0] & 0x1fffff, scale, alpha);
#if LOG_DISPLAY_LIST #if LOG_DISPLAY_LIST
printf("0xffff0011: %08X, %08X, %08X, %08X\n", w[0], w[1], w[2], w[3]); printf("0xffff0011: %08X, %08X, %08X, %08X\n", w[0], w[1], w[2], w[3]);
@ -1594,7 +1594,7 @@ UINT32 taitotz_state::screen_update_taitotz(screen_device &screen, bitmap_rgb32
{ {
bitmap.fill(0x000000, cliprect); bitmap.fill(0x000000, cliprect);
m_renderer->set_fb(&bitmap); m_renderer->set_fb(&bitmap);
m_renderer->render_displaylist(machine(), cliprect); m_renderer->render_displaylist(cliprect);
UINT16 *screen_src = (UINT16*)&m_screen_ram[m_scr_base]; UINT16 *screen_src = (UINT16*)&m_screen_ram[m_scr_base];
@ -1618,7 +1618,7 @@ UINT32 taitotz_state::screen_update_taitotz(screen_device &screen, bitmap_rgb32
return 0; return 0;
} }
void taitotz_state::draw_tile(taitotz_state *state, UINT32 pos, UINT32 tile) void taitotz_state::draw_tile(UINT32 pos, UINT32 tile)
{ {
int tileu = (tile & 0x1f) * 16; int tileu = (tile & 0x1f) * 16;
int tilev = ((tile >> 5)) * 16; int tilev = ((tile >> 5)) * 16;
@ -1660,7 +1660,7 @@ void taitotz_state::draw_tile(taitotz_state *state, UINT32 pos, UINT32 tile)
batlgr2 into 0x9e0000 batlgr2 into 0x9e0000
*/ */
UINT32 taitotz_state::video_mem_r(taitotz_state *state, UINT32 address) UINT32 taitotz_state::video_mem_r(UINT32 address)
{ {
if (address >= 0x800000 && address < 0x1000000) if (address >= 0x800000 && address < 0x1000000)
{ {
@ -1681,7 +1681,7 @@ UINT32 taitotz_state::video_mem_r(taitotz_state *state, UINT32 address)
} }
} }
void taitotz_state::video_mem_w(taitotz_state *state, UINT32 address, UINT32 data) void taitotz_state::video_mem_w(UINT32 address, UINT32 data)
{ {
if (address >= 0x800000 && address < 0x1000000) if (address >= 0x800000 && address < 0x1000000)
{ {
@ -1701,7 +1701,7 @@ void taitotz_state::video_mem_w(taitotz_state *state, UINT32 address, UINT32 dat
} }
} }
UINT32 taitotz_state::video_reg_r(taitotz_state *state, UINT32 reg) UINT32 taitotz_state::video_reg_r(UINT32 reg)
{ {
switch ((reg >> 28) & 0xf) switch ((reg >> 28) & 0xf)
{ {
@ -1731,7 +1731,7 @@ UINT32 taitotz_state::video_reg_r(taitotz_state *state, UINT32 reg)
} }
case 0xb: case 0xb:
{ {
return video_mem_r(state, reg & 0xfffffff); return video_mem_r(reg & 0xfffffff);
} }
default: default:
{ {
@ -1764,7 +1764,7 @@ video_reg_w: r: 20000003 d: 019501AA
video_reg_w: r: 20000004 d: 00000000 video_reg_w: r: 20000004 d: 00000000
*/ */
void taitotz_state::video_reg_w(taitotz_state *state, UINT32 reg, UINT32 data) void taitotz_state::video_reg_w(UINT32 reg, UINT32 data)
{ {
switch ((reg >> 28) & 0xf) switch ((reg >> 28) & 0xf)
{ {
@ -1794,12 +1794,12 @@ void taitotz_state::video_reg_w(taitotz_state *state, UINT32 reg, UINT32 data)
{ {
UINT32 pos = (data >> 12) & 0xfff; UINT32 pos = (data >> 12) & 0xfff;
UINT32 tile = data & 0xfff; UINT32 tile = data & 0xfff;
draw_tile(state, pos, tile); draw_tile(pos, tile);
break; break;
} }
case 0xb: // RAM write? case 0xb: // RAM write?
{ {
video_mem_w(state, m_video_ram_ptr, data); video_mem_w(m_video_ram_ptr, data);
m_video_ram_ptr++; m_video_ram_ptr++;
break; break;
} }
@ -1839,7 +1839,7 @@ READ64_MEMBER(taitotz_state::video_chip_r)
{ {
case 0x0: case 0x0:
{ {
r |= (UINT64)(video_reg_r(this, m_video_reg)) << 32; r |= (UINT64)(video_reg_r(m_video_reg)) << 32;
break; break;
} }
@ -1885,7 +1885,7 @@ WRITE64_MEMBER(taitotz_state::video_chip_w)
{ {
case 0: case 0:
{ {
video_reg_w(this, m_video_reg, regdata); video_reg_w(m_video_reg, regdata);
break; break;
} }
case 0x8: case 0x8:
@ -1940,12 +1940,12 @@ READ64_MEMBER(taitotz_state::video_fifo_r)
UINT64 r = 0; UINT64 r = 0;
if (ACCESSING_BITS_32_63) if (ACCESSING_BITS_32_63)
{ {
r |= (UINT64)(video_mem_r(this, m_video_ram_ptr)) << 32; r |= (UINT64)(video_mem_r(m_video_ram_ptr)) << 32;
m_video_ram_ptr++; m_video_ram_ptr++;
} }
if (ACCESSING_BITS_0_31) if (ACCESSING_BITS_0_31)
{ {
r |= (UINT64)(video_mem_r(this, m_video_ram_ptr)); r |= (UINT64)(video_mem_r(m_video_ram_ptr));
m_video_ram_ptr++; m_video_ram_ptr++;
} }
@ -1963,7 +1963,7 @@ WRITE64_MEMBER(taitotz_state::video_fifo_w)
{ {
if (m_video_fifo_ptr >= 8) if (m_video_fifo_ptr >= 8)
{ {
video_mem_w(this, m_video_ram_ptr, (UINT32)(data >> 32)); video_mem_w(m_video_ram_ptr, (UINT32)(data >> 32));
m_video_ram_ptr++; m_video_ram_ptr++;
} }
m_video_fifo_ptr++; m_video_fifo_ptr++;
@ -1972,7 +1972,7 @@ WRITE64_MEMBER(taitotz_state::video_fifo_w)
{ {
if (m_video_fifo_ptr >= 8) if (m_video_fifo_ptr >= 8)
{ {
video_mem_w(this, m_video_ram_ptr, (UINT32)(data)); video_mem_w(m_video_ram_ptr, (UINT32)(data));
m_video_ram_ptr++; m_video_ram_ptr++;
} }
m_video_fifo_ptr++; m_video_fifo_ptr++;

View File

@ -127,6 +127,10 @@ public:
required_device<timer_device> m_int_timer; required_device<timer_device> m_int_timer;
optional_device<timer_device> m_int_timer_left; optional_device<timer_device> m_int_timer_left;
optional_device<timer_device> m_int_timer_right; optional_device<timer_device> m_int_timer_right;
optional_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
int m_rasflag; int m_rasflag;
int m_old_rasflag; int m_old_rasflag;
DECLARE_READ16_MEMBER(cave_irq_cause_r); DECLARE_READ16_MEMBER(cave_irq_cause_r);
@ -237,20 +241,18 @@ public:
void sailormn_tilebank_w(int bank); void sailormn_tilebank_w(int bank);
DECLARE_WRITE_LINE_MEMBER(irqhandler); DECLARE_WRITE_LINE_MEMBER(irqhandler);
DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); DECLARE_WRITE_LINE_MEMBER(sound_irq_gen);
optional_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
void update_irq_state(); void update_irq_state();
void unpack_sprites(const char *region); void unpack_sprites(const char *region);
void ddonpach_unpack_sprites(const char *region); void ddonpach_unpack_sprites(const char *region);
void esprade_unpack_sprites(const char *region); void esprade_unpack_sprites(const char *region);
void sailormn_unpack_tiles(const char *region);
private: private:
inline void get_tile_info( tile_data &tileinfo, int tile_index, int GFX ); inline void get_tile_info( tile_data &tileinfo, int tile_index, int GFX );
inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 priority, UINT32 priority2, int GFX ); inline void tilemap_draw( int chip, screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 priority, UINT32 priority2, int GFX );
inline void vram_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX ); inline void vram_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX );
inline void vram_8x8_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX ); inline void vram_8x8_w( address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED UINT16 data, ATTR_UNUSED UINT16 mem_mask, int GFX );
inline void vctrl_w( address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX );
void set_pens(int chip); void set_pens(int chip);
void cave_vh_start( int num ); void cave_vh_start( int num );
void get_sprite_info_cave(int chip); void get_sprite_info_cave(int chip);
@ -265,4 +267,6 @@ private:
void sprite_draw_cave_zbuf( int chip, int priority ); void sprite_draw_cave_zbuf( int chip, int priority );
void sprite_draw_donpachi( int chip, int priority ); void sprite_draw_donpachi( int chip, int priority );
void sprite_draw_donpachi_zbuf( int chip, int priority ); void sprite_draw_donpachi_zbuf( int chip, int priority );
void init_cave();
void show_leds();
}; };

View File

@ -8,14 +8,18 @@ class coolpool_state : public driver_device
public: public:
coolpool_state(const machine_config &mconfig, device_type type, const char *tag) coolpool_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_tlc34076(*this, "tlc34076"),
m_vram_base(*this, "vram_base"),
m_nvram(*this, "nvram"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_dsp(*this, "dsp"), m_dsp(*this, "dsp"),
m_dac(*this, "dac"){ } m_dac(*this, "dac"),
m_tlc34076(*this, "tlc34076"),
m_vram_base(*this, "vram_base"),
m_nvram(*this, "nvram") { }
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_dsp;
required_device<dac_device> m_dac;
optional_device<tlc34076_device> m_tlc34076; optional_device<tlc34076_device> m_tlc34076;
required_shared_ptr<UINT16> m_vram_base; required_shared_ptr<UINT16> m_vram_base;
required_shared_ptr<UINT16> m_nvram; required_shared_ptr<UINT16> m_nvram;
@ -34,8 +38,6 @@ public:
UINT16 m_result; UINT16 m_result;
UINT16 m_lastresult; UINT16 m_lastresult;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_dsp;
UINT16 m_nvram_write_seq[NVRAM_UNLOCK_SEQ_LEN]; UINT16 m_nvram_write_seq[NVRAM_UNLOCK_SEQ_LEN];
UINT8 m_nvram_write_enable; UINT8 m_nvram_write_enable;
UINT8 m_old_cmd; UINT8 m_old_cmd;
@ -73,5 +75,5 @@ public:
TIMER_CALLBACK_MEMBER(deferred_iop_w); TIMER_CALLBACK_MEMBER(deferred_iop_w);
TIMER_DEVICE_CALLBACK_MEMBER(nvram_write_timeout); TIMER_DEVICE_CALLBACK_MEMBER(nvram_write_timeout);
TIMER_DEVICE_CALLBACK_MEMBER(amerdart_audio_int_gen); TIMER_DEVICE_CALLBACK_MEMBER(amerdart_audio_int_gen);
required_device<dac_device> m_dac; void register_state_save();
}; };

View File

@ -18,9 +18,9 @@ public:
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"), m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"), m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_samples(*this, "samples"), m_samples(*this, "samples"),
m_dac(*this, "dac"), m_dac(*this, "dac"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"), m_screen(*this, "screen"),
m_palette(*this, "palette") { } m_palette(*this, "palette") { }
@ -30,7 +30,8 @@ public:
optional_shared_ptr<UINT8> m_spriteram; optional_shared_ptr<UINT8> m_spriteram;
/* video-related */ /* video-related */
pen_t (*m_map_color)(running_machine &machine, UINT8 x, UINT8 y); typedef pen_t (cosmic_state::*color_func)(UINT8 x, UINT8 y);
color_func m_map_color;
int m_color_registers[3]; int m_color_registers[3];
int m_background_enable; int m_background_enable;
int m_magspot_pen_mask; int m_magspot_pen_mask;
@ -47,8 +48,13 @@ public:
DECLARE_READ8_MEMBER( interrupt_level ); DECLARE_READ8_MEMBER( interrupt_level );
/* devices */ /* devices */
required_device<cpu_device> m_maincpu;
optional_device<samples_device> m_samples; optional_device<samples_device> m_samples;
required_device<dac_device> m_dac; required_device<dac_device> m_dac;
optional_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
DECLARE_WRITE8_MEMBER(panic_sound_output_w); DECLARE_WRITE8_MEMBER(panic_sound_output_w);
DECLARE_WRITE8_MEMBER(panic_sound_output2_w); DECLARE_WRITE8_MEMBER(panic_sound_output2_w);
DECLARE_WRITE8_MEMBER(cosmicg_output_w); DECLARE_WRITE8_MEMBER(cosmicg_output_w);
@ -85,13 +91,13 @@ public:
UINT32 screen_update_devzone(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_devzone(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_nomnlnd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_nomnlnd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(panic_scanline); TIMER_DEVICE_CALLBACK_MEMBER(panic_scanline);
void draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect ); void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int extra_sprites ); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int extra_sprites);
void cosmica_draw_starfield( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); void cosmica_draw_starfield(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void devzone_draw_grid( bitmap_ind16 &bitmap, const rectangle &cliprect ); void devzone_draw_grid(bitmap_ind16 &bitmap, const rectangle &cliprect);
void nomnlnd_draw_background( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ); void nomnlnd_draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu; pen_t panic_map_color(UINT8 x, UINT8 y);
optional_device<gfxdecode_device> m_gfxdecode; pen_t cosmica_map_color(UINT8 x, UINT8 y);
required_device<screen_device> m_screen; pen_t cosmicg_map_color(UINT8 x, UINT8 y);
required_device<palette_device> m_palette; pen_t magspot_map_color(UINT8 x, UINT8 y);
}; };

View File

@ -258,7 +258,7 @@ public:
virtual void video_start(); virtual void video_start();
DECLARE_PALETTE_INIT(galaxian); DECLARE_PALETTE_INIT(galaxian);
DECLARE_PALETTE_INIT(moonwar); DECLARE_PALETTE_INIT(moonwar);
void tenspot_set_game_bank(running_machine& machine, int bank, int from_game); void tenspot_set_game_bank(int bank, int from_game);
UINT32 screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(interrupt_gen); INTERRUPT_GEN_MEMBER(interrupt_gen);
INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen); INTERRUPT_GEN_MEMBER(fakechange_interrupt_gen);

View File

@ -83,6 +83,7 @@ private:
void log_fifo_command(const UINT32 *data, int numwords, const char *suffix); void log_fifo_command(const UINT32 *data, int numwords, const char *suffix);
void log_waveram(UINT32 length_and_base); void log_waveram(UINT32 length_and_base);
void update_gun_irq();
}; };

View File

@ -267,6 +267,8 @@ public:
void update_bitmap(screen_device &screen, struct layer_info *layer, const rectangle &cliprect); void update_bitmap(screen_device &screen, struct layer_info *layer, const rectangle &cliprect);
void update_background(struct layer_info *layer, const rectangle &cliprect); void update_background(struct layer_info *layer, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler); DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler);
void signal_sound_irq(int which);
void clear_sound_irq(int which);
}; };
/*----------- defined in machine/segas32.c -----------*/ /*----------- defined in machine/segas32.c -----------*/

View File

@ -16,50 +16,46 @@ WRITE8_MEMBER(cosmic_state::cosmic_color_register_w)
} }
static pen_t panic_map_color( running_machine &machine, UINT8 x, UINT8 y ) pen_t cosmic_state::panic_map_color( UINT8 x, UINT8 y )
{ {
cosmic_state *state = machine.driver_data<cosmic_state>(); offs_t offs = (m_color_registers[0] << 9) | (m_color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3);
offs_t offs = (state->m_color_registers[0] << 9) | (state->m_color_registers[2] << 10) | ((x >> 4) << 5) | (y >> 3); pen_t pen = memregion("user1")->base()[offs];
pen_t pen = state->memregion("user1")->base()[offs];
if (state->m_color_registers[1]) if (m_color_registers[1])
pen >>= 4; pen >>= 4;
return pen & 0x0f; return pen & 0x0f;
} }
static pen_t cosmica_map_color( running_machine &machine, UINT8 x, UINT8 y ) pen_t cosmic_state::cosmica_map_color( UINT8 x, UINT8 y )
{ {
cosmic_state *state = machine.driver_data<cosmic_state>(); offs_t offs = (m_color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3);
offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 4) << 5) | (y >> 3); pen_t pen = memregion("user1")->base()[offs];
pen_t pen = state->memregion("user1")->base()[offs];
if (state->m_color_registers[1]) // 0 according to the schematics, but that breaks alien formation colors if (m_color_registers[1]) // 0 according to the schematics, but that breaks alien formation colors
pen >>= 4; pen >>= 4;
return pen & 0x07; return pen & 0x07;
} }
static pen_t cosmicg_map_color( running_machine &machine, UINT8 x, UINT8 y ) pen_t cosmic_state::cosmicg_map_color( UINT8 x, UINT8 y )
{ {
cosmic_state *state = machine.driver_data<cosmic_state>(); offs_t offs = (m_color_registers[0] << 8) | (m_color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4);
offs_t offs = (state->m_color_registers[0] << 8) | (state->m_color_registers[1] << 9) | ((y >> 4) << 4) | (x >> 4); pen_t pen = memregion("user1")->base()[offs];
pen_t pen = state->memregion("user1")->base()[offs];
/* the upper 4 bits are for cocktail mode support */ /* the upper 4 bits are for cocktail mode support */
return pen & 0x0f; return pen & 0x0f;
} }
static pen_t magspot_map_color( running_machine &machine, UINT8 x, UINT8 y ) pen_t cosmic_state::magspot_map_color( UINT8 x, UINT8 y )
{ {
cosmic_state *state = machine.driver_data<cosmic_state>(); offs_t offs = (m_color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4);
offs_t offs = (state->m_color_registers[0] << 9) | ((x >> 3) << 4) | (y >> 4); pen_t pen = memregion("user1")->base()[offs];
pen_t pen = state->memregion("user1")->base()[offs];
if (state->m_color_registers[1]) if (m_color_registers[1])
pen >>= 4; pen >>= 4;
return pen & state->m_magspot_pen_mask; return pen & m_magspot_pen_mask;
} }
@ -101,7 +97,7 @@ PALETTE_INIT_MEMBER(cosmic_state,panic)
palette.set_pen_indirect(i, ctabentry); palette.set_pen_indirect(i, ctabentry);
} }
m_map_color = panic_map_color; m_map_color = &cosmic_state::panic_map_color;
} }
@ -141,7 +137,7 @@ PALETTE_INIT_MEMBER(cosmic_state,cosmica)
palette.set_pen_indirect(i + 0x20, ctabentry); palette.set_pen_indirect(i + 0x20, ctabentry);
} }
m_map_color = cosmica_map_color; m_map_color = &cosmic_state::cosmica_map_color;
} }
@ -167,7 +163,7 @@ PALETTE_INIT_MEMBER(cosmic_state,cosmicg)
palette.set_pen_color(i, rgb_t(r, g, b)); palette.set_pen_color(i, rgb_t(r, g, b));
} }
m_map_color = cosmicg_map_color; m_map_color = &cosmic_state::cosmicg_map_color;
} }
@ -197,7 +193,7 @@ PALETTE_INIT_MEMBER(cosmic_state,magspot)
palette.set_pen_indirect(i, ctabentry); palette.set_pen_indirect(i, ctabentry);
} }
m_map_color = magspot_map_color; m_map_color = &cosmic_state::magspot_map_color;
m_magspot_pen_mask = 0x0f; m_magspot_pen_mask = 0x0f;
} }
@ -225,7 +221,7 @@ PALETTE_INIT_MEMBER(cosmic_state,nomnlnd)
palette.set_pen_indirect(i, ctabentry); palette.set_pen_indirect(i, ctabentry);
} }
m_map_color = magspot_map_color; m_map_color = &cosmic_state::magspot_map_color;
m_magspot_pen_mask = 0x07; m_magspot_pen_mask = 0x07;
} }
@ -248,7 +244,7 @@ void cosmic_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect
UINT8 x = offs << 3; UINT8 x = offs << 3;
UINT8 y = offs >> 5; UINT8 y = offs >> 5;
pen_t pen = m_map_color(machine(), x, y); pen_t pen = (this->*m_map_color)(x, y);
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {