mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
Some cleanups of remaining machine->primary_screen references in drivers. Mostly
minor except for the megadriv stuff, where I made a first pass at removing some of the legacy cruft.
This commit is contained in:
parent
035a870960
commit
ed53641fc7
@ -598,15 +598,14 @@ WRITE8_MEMBER(dynax_state::hjingi_hopper_w)
|
||||
m_hopper = data & 0x01;
|
||||
}
|
||||
|
||||
static UINT8 hjingi_hopper_bit( running_machine &machine )
|
||||
UINT8 dynax_state::hjingi_hopper_bit()
|
||||
{
|
||||
dynax_state *state = machine.driver_data<dynax_state>();
|
||||
return (state->m_hopper && !(machine.primary_screen->frame_number() % 10)) ? 0 : (1 << 6);
|
||||
return (m_hopper && !(m_screen->frame_number() % 10)) ? 0 : (1 << 6);
|
||||
}
|
||||
|
||||
READ8_MEMBER(dynax_state::hjingi_keyboard_0_r)
|
||||
{
|
||||
return hanamai_keyboard_0_r(space, 0) | hjingi_hopper_bit(machine());
|
||||
return hanamai_keyboard_0_r(space, 0) | hjingi_hopper_bit();
|
||||
}
|
||||
|
||||
READ8_MEMBER(dynax_state::hjingi_keyboard_1_r)
|
||||
|
@ -235,19 +235,19 @@ static WRITE16_DEVICE_HANDLER( fdt_rip_w )
|
||||
D7 = /FDONE
|
||||
*/
|
||||
|
||||
static UINT8 rip_status_in(running_machine &machine)
|
||||
UINT8 esripsys_state::static_rip_status_in(running_machine &machine) { return machine.driver_data<esripsys_state>()->rip_status_in(); }
|
||||
UINT8 esripsys_state::rip_status_in()
|
||||
{
|
||||
esripsys_state *state = machine.driver_data<esripsys_state>();
|
||||
int vpos = machine.primary_screen->vpos();
|
||||
int vpos = m_screen->vpos();
|
||||
UINT8 _vblank = !(vpos >= ESRIPSYS_VBLANK_START);
|
||||
// UINT8 _hblank = !machine.primary_screen->hblank();
|
||||
// UINT8 _hblank = !m_screen->hblank();
|
||||
|
||||
return _vblank
|
||||
| (state->m_hblank << 1)
|
||||
| (state->m_12sel << 2)
|
||||
| (state->m_fbsel << 4)
|
||||
| (m_hblank << 1)
|
||||
| (m_12sel << 2)
|
||||
| (m_fbsel << 4)
|
||||
| ((vpos & 1) << 5)
|
||||
| (state->m_f_status & 0x80);
|
||||
| (m_f_status & 0x80);
|
||||
}
|
||||
|
||||
/*************************************
|
||||
@ -685,7 +685,7 @@ static const esrip_config rip_config =
|
||||
{
|
||||
fdt_rip_r,
|
||||
fdt_rip_w,
|
||||
rip_status_in,
|
||||
&esripsys_state::static_rip_status_in,
|
||||
esripsys_draw,
|
||||
"proms"
|
||||
};
|
||||
|
@ -1650,12 +1650,12 @@ static const ay8910_interface ay8910_config =
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void generate_interrupt(running_machine &machine, int state_num)
|
||||
void itech8_state::static_generate_interrupt(running_machine &machine, int state_num) { machine.driver_data<itech8_state>()->generate_interrupt(state_num); }
|
||||
void itech8_state::generate_interrupt(int state_num)
|
||||
{
|
||||
itech8_state *state = machine.driver_data<itech8_state>();
|
||||
state->itech8_update_interrupts(-1, state_num, -1);
|
||||
itech8_update_interrupts(-1, state_num, -1);
|
||||
|
||||
if (FULL_LOGGING && state_num) logerror("------------ DISPLAY INT (%d) --------------\n", machine.primary_screen->vpos());
|
||||
if (FULL_LOGGING && state_num) logerror("------------ DISPLAY INT (%d) --------------\n", m_screen->vpos());
|
||||
}
|
||||
|
||||
|
||||
@ -1663,7 +1663,7 @@ static const struct tms34061_interface tms34061intf =
|
||||
{
|
||||
8, /* VRAM address is (row << rowshift) | col */
|
||||
0x40000, /* size of video RAM */
|
||||
generate_interrupt /* interrupt gen callback */
|
||||
&itech8_state::static_generate_interrupt /* interrupt gen callback */
|
||||
};
|
||||
|
||||
|
||||
|
@ -526,7 +526,7 @@ void m10_state::device_timer(emu_timer &timer, device_timer_id id, int param, vo
|
||||
INTERRUPT_GEN_MEMBER(m10_state::m11_interrupt)
|
||||
{
|
||||
device.execute().set_input_line(0, ASSERT_LINE);
|
||||
//timer_set(machine.primary_screen->time_until_pos(IREMM10_VBEND), TIMER_INTERRUPT, -1);
|
||||
//timer_set(m_screen->time_until_pos(IREMM10_VBEND), TIMER_INTERRUPT, -1);
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(m10_state::m10_interrupt)
|
||||
|
@ -1308,28 +1308,25 @@ UINT32 segac2_state::screen_update_segac2_new(screen_device &screen, bitmap_rgb3
|
||||
|
||||
|
||||
// the main interrupt on C2 comes from the vdp line used to drive the z80 interrupt on a regular genesis(!)
|
||||
void genesis_vdp_sndirqline_callback_segac2(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(segac2_state::genesis_vdp_sndirqline_callback_segac2)
|
||||
{
|
||||
segac2_state *drvstate = machine.driver_data<segac2_state>();
|
||||
|
||||
if (state==true)
|
||||
drvstate->m_maincpu->set_input_line(6, HOLD_LINE);
|
||||
if (state==ASSERT_LINE)
|
||||
m_maincpu->set_input_line(6, HOLD_LINE);
|
||||
}
|
||||
|
||||
// the line usually used to drive irq6 is not connected
|
||||
void genesis_vdp_lv6irqline_callback_segac2(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(segac2_state::genesis_vdp_lv6irqline_callback_segac2)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
// the scanline interrupt seems connected as usual
|
||||
void genesis_vdp_lv4irqline_callback_segac2(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(segac2_state::genesis_vdp_lv4irqline_callback_segac2)
|
||||
{
|
||||
segac2_state *drvstate = machine.driver_data<segac2_state>();
|
||||
if (state==true)
|
||||
drvstate->m_maincpu->set_input_line(4, HOLD_LINE);
|
||||
if (state==ASSERT_LINE)
|
||||
m_maincpu->set_input_line(4, HOLD_LINE);
|
||||
else
|
||||
drvstate->m_maincpu->set_input_line(4, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(4, CLEAR_LINE);
|
||||
}
|
||||
|
||||
static const sega315_5124_interface sms_vdp_ntsc_intf =
|
||||
@ -1359,9 +1356,9 @@ static MACHINE_CONFIG_START( segac, segac2_state )
|
||||
MCFG_DEVICE_ADD("gen_vdp", SEGA_GEN_VDP, 0)
|
||||
MCFG_VIDEO_SET_SCREEN("megadriv")
|
||||
MCFG_DEVICE_CONFIG( sms_vdp_ntsc_intf )
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, genesis_vdp_sndirqline_callback_segac2);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, genesis_vdp_lv6irqline_callback_segac2);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, genesis_vdp_lv4irqline_callback_segac2);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, DEVCB2_WRITELINE(segac2_state, genesis_vdp_sndirqline_callback_segac2));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, DEVCB2_WRITELINE(segac2_state, genesis_vdp_lv6irqline_callback_segac2));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, DEVCB2_WRITELINE(segac2_state, genesis_vdp_lv4irqline_callback_segac2));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_alt_timing(*device, 1);
|
||||
|
||||
MCFG_TIMER_ADD_SCANLINE("scantimer", megadriv_scanline_timer_callback_alt_timing, "megadriv", 0, 1)
|
||||
|
@ -1216,15 +1216,15 @@ GFXDECODE_END
|
||||
|
||||
|
||||
// are any of the VDP interrupt lines hooked up to anything?
|
||||
void genesis_vdp_sndirqline_callback_segas18(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(segas18_state::genesis_vdp_sndirqline_callback_segas18)
|
||||
{
|
||||
}
|
||||
|
||||
void genesis_vdp_lv6irqline_callback_segas18(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(segas18_state::genesis_vdp_lv6irqline_callback_segas18)
|
||||
{
|
||||
}
|
||||
|
||||
void genesis_vdp_lv4irqline_callback_segas18(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(segas18_state::genesis_vdp_lv4irqline_callback_segas18)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1259,9 +1259,9 @@ static MACHINE_CONFIG_START( system18, segas18_state )
|
||||
|
||||
MCFG_DEVICE_ADD("gen_vdp", SEGA_GEN_VDP, 0)
|
||||
MCFG_DEVICE_CONFIG( sms_vdp_ntsc_intf )
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, genesis_vdp_sndirqline_callback_segas18);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, genesis_vdp_lv6irqline_callback_segas18);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, genesis_vdp_lv4irqline_callback_segas18);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, DEVCB2_WRITELINE(segas18_state, genesis_vdp_sndirqline_callback_segas18));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, DEVCB2_WRITELINE(segas18_state, genesis_vdp_lv6irqline_callback_segas18));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, DEVCB2_WRITELINE(segas18_state, genesis_vdp_lv4irqline_callback_segas18));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_alt_timing(*device, 1);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_palwrite_base(*device, 0x2000);
|
||||
|
||||
|
@ -533,81 +533,7 @@ struct taitotz_polydata
|
||||
VECTOR3 light;
|
||||
};
|
||||
|
||||
class taitotz_renderer : public poly_manager<float, taitotz_polydata, 6, 50000>
|
||||
{
|
||||
public:
|
||||
taitotz_renderer(running_machine &machine, int width, int height, UINT32 *texram)
|
||||
: poly_manager<float, taitotz_polydata, 6, 50000>(machine)
|
||||
{
|
||||
m_zbuffer = auto_bitmap_ind32_alloc(machine, width, height);
|
||||
m_texture = texram;
|
||||
|
||||
m_diffuse_intensity = 224;
|
||||
m_ambient_intensity = 32;
|
||||
m_specular_intensity = 256;
|
||||
m_specular_power = 20;
|
||||
}
|
||||
|
||||
void set_fb(bitmap_rgb32 *fb) { m_fb = fb; }
|
||||
void render_displaylist(running_machine &machine, const rectangle &cliprect);
|
||||
void draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha);
|
||||
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);
|
||||
void setup_viewport(int x, int y, int width, int height, int center_x, int center_y);
|
||||
void draw_scanline_noz(INT32 scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid);
|
||||
void draw_scanline(INT32 scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
POLY_Z = 0,
|
||||
POLY_U = 1,
|
||||
POLY_V = 2,
|
||||
POLY_NX = 3,
|
||||
POLY_NY = 4,
|
||||
POLY_NZ = 5,
|
||||
};
|
||||
|
||||
//static const float ZBUFFER_MAX = 10000000000.0f;
|
||||
|
||||
bitmap_rgb32 *m_fb;
|
||||
bitmap_ind32 *m_zbuffer;
|
||||
UINT32 *m_texture;
|
||||
|
||||
PLANE m_clip_plane[6];
|
||||
float m_matrix[4][3];
|
||||
|
||||
float m_diffuse_intensity;
|
||||
float m_ambient_intensity;
|
||||
float m_specular_intensity;
|
||||
float m_specular_power;
|
||||
|
||||
int m_ambient_r;
|
||||
int m_ambient_g;
|
||||
int m_ambient_b;
|
||||
int m_diffuse_r;
|
||||
int m_diffuse_g;
|
||||
int m_diffuse_b;
|
||||
int m_specular_r;
|
||||
int m_specular_g;
|
||||
int m_specular_b;
|
||||
|
||||
float m_vp_center_x;
|
||||
float m_vp_center_y;
|
||||
float m_vp_focus;
|
||||
float m_vp_x;
|
||||
float m_vp_y;
|
||||
float m_vp_mul;
|
||||
|
||||
UINT32 m_reg_100;
|
||||
UINT32 m_reg_101;
|
||||
UINT32 m_reg_102;
|
||||
|
||||
UINT32 m_reg_10000100;
|
||||
UINT32 m_reg_10000101;
|
||||
};
|
||||
|
||||
|
||||
class taitotz_renderer;
|
||||
|
||||
class taitotz_state : public driver_device
|
||||
{
|
||||
@ -701,6 +627,84 @@ public:
|
||||
void init_taitotz_111a();
|
||||
};
|
||||
|
||||
class taitotz_renderer : public poly_manager<float, taitotz_polydata, 6, 50000>
|
||||
{
|
||||
public:
|
||||
taitotz_renderer(taitotz_state &state, int width, int height, UINT32 *texram)
|
||||
: poly_manager<float, taitotz_polydata, 6, 50000>(state.machine()),
|
||||
m_state(state)
|
||||
{
|
||||
m_zbuffer = auto_bitmap_ind32_alloc(state.machine(), width, height);
|
||||
m_texture = texram;
|
||||
|
||||
m_diffuse_intensity = 224;
|
||||
m_ambient_intensity = 32;
|
||||
m_specular_intensity = 256;
|
||||
m_specular_power = 20;
|
||||
}
|
||||
|
||||
void set_fb(bitmap_rgb32 *fb) { m_fb = fb; }
|
||||
void render_displaylist(running_machine &machine, const rectangle &cliprect);
|
||||
void draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha);
|
||||
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);
|
||||
void setup_viewport(int x, int y, int width, int height, int center_x, int center_y);
|
||||
void draw_scanline_noz(INT32 scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid);
|
||||
void draw_scanline(INT32 scanline, const extent_t &extent, const taitotz_polydata &extradata, int threadid);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
POLY_Z = 0,
|
||||
POLY_U = 1,
|
||||
POLY_V = 2,
|
||||
POLY_NX = 3,
|
||||
POLY_NY = 4,
|
||||
POLY_NZ = 5,
|
||||
};
|
||||
|
||||
//static const float ZBUFFER_MAX = 10000000000.0f;
|
||||
|
||||
taitotz_state &m_state;
|
||||
bitmap_rgb32 *m_fb;
|
||||
bitmap_ind32 *m_zbuffer;
|
||||
UINT32 *m_texture;
|
||||
|
||||
PLANE m_clip_plane[6];
|
||||
float m_matrix[4][3];
|
||||
|
||||
float m_diffuse_intensity;
|
||||
float m_ambient_intensity;
|
||||
float m_specular_intensity;
|
||||
float m_specular_power;
|
||||
|
||||
int m_ambient_r;
|
||||
int m_ambient_g;
|
||||
int m_ambient_b;
|
||||
int m_diffuse_r;
|
||||
int m_diffuse_g;
|
||||
int m_diffuse_b;
|
||||
int m_specular_r;
|
||||
int m_specular_g;
|
||||
int m_specular_b;
|
||||
|
||||
float m_vp_center_x;
|
||||
float m_vp_center_y;
|
||||
float m_vp_focus;
|
||||
float m_vp_x;
|
||||
float m_vp_y;
|
||||
float m_vp_mul;
|
||||
|
||||
UINT32 m_reg_100;
|
||||
UINT32 m_reg_101;
|
||||
UINT32 m_reg_102;
|
||||
|
||||
UINT32 m_reg_10000100;
|
||||
UINT32 m_reg_10000101;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
void taitotz_state::taitotz_exit()
|
||||
{
|
||||
@ -751,7 +755,7 @@ void taitotz_state::video_start()
|
||||
m_texture_ram = auto_alloc_array(machine(), UINT32, 0x800000);
|
||||
|
||||
/* create renderer */
|
||||
m_renderer = auto_alloc(machine(), taitotz_renderer(machine(), width, height, m_texture_ram));
|
||||
m_renderer = auto_alloc(machine(), taitotz_renderer(*this, width, height, m_texture_ram));
|
||||
|
||||
//machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(taitotz_exit), &machine()));
|
||||
}
|
||||
@ -1158,10 +1162,9 @@ int taitotz_renderer::clip_polygon(const vertex_t *v, int num_vertices, PLANE cp
|
||||
|
||||
void taitotz_renderer::draw_object(running_machine &machine, UINT32 address, float scale, UINT8 alpha)
|
||||
{
|
||||
taitotz_state *state = machine.driver_data<taitotz_state>();
|
||||
const rectangle& visarea = machine.primary_screen->visible_area();
|
||||
const rectangle& visarea = m_state.m_screen->visible_area();
|
||||
|
||||
UINT32 *src = &state->m_screen_ram[address];
|
||||
UINT32 *src = &m_state.m_screen_ram[address];
|
||||
taitotz_renderer::vertex_t v[10];
|
||||
|
||||
|
||||
@ -1343,21 +1346,19 @@ void taitotz_renderer::setup_viewport(int x, int y, int width, int height, int c
|
||||
|
||||
void taitotz_renderer::render_displaylist(running_machine &machine, const rectangle &cliprect)
|
||||
{
|
||||
taitotz_state *state = machine.driver_data<taitotz_state>();
|
||||
|
||||
float zvalue = 0;//ZBUFFER_MAX;
|
||||
m_zbuffer->fill(*(int*)&zvalue, cliprect);
|
||||
|
||||
const rectangle& visarea = machine.primary_screen->visible_area();
|
||||
const rectangle& visarea = m_state.m_screen->visible_area();
|
||||
vertex_t v[8];
|
||||
|
||||
UINT32 *src = (UINT32*)&state->m_work_ram[0];
|
||||
UINT32 *src = (UINT32*)&m_state.m_work_ram[0];
|
||||
|
||||
UINT32 w[32];
|
||||
int j;
|
||||
int end = 0;
|
||||
|
||||
UINT32 index = state->m_displist_addr / 4;
|
||||
UINT32 index = m_state.m_displist_addr / 4;
|
||||
|
||||
setup_viewport(0, 0, 256, 192, 256, 192);
|
||||
|
||||
@ -2426,8 +2427,6 @@ READ8_MEMBER(taitotz_state::tlcs900_port_read)
|
||||
|
||||
WRITE8_MEMBER(taitotz_state::tlcs900_port_write)
|
||||
{
|
||||
//taitotz_state *state = device->machine().driver_data<taitotz_state>();
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case 0x7:
|
||||
@ -2438,7 +2437,7 @@ WRITE8_MEMBER(taitotz_state::tlcs900_port_write)
|
||||
case 0x8:
|
||||
if (data & 1)
|
||||
{
|
||||
//state->m_mbox_ram[0x17] = 0x55;
|
||||
//m_mbox_ram[0x17] = 0x55;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
int m_beamyadd;
|
||||
int m_palette_bank;
|
||||
UINT8 m_gunx[2];
|
||||
void get_crosshair_xy(int player, int &x, int &y);
|
||||
DECLARE_WRITE16_MEMBER(rapidfir_transparent_w);
|
||||
DECLARE_READ16_MEMBER(rapidfir_transparent_r);
|
||||
DECLARE_WRITE16_MEMBER(tickee_control_w);
|
||||
@ -89,12 +90,12 @@ protected:
|
||||
*
|
||||
*************************************/
|
||||
|
||||
INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *y)
|
||||
inline void tickee_state::get_crosshair_xy(int player, int &x, int &y)
|
||||
{
|
||||
const rectangle &visarea = machine.primary_screen->visible_area();
|
||||
const rectangle &visarea = m_screen->visible_area();
|
||||
|
||||
*x = (((machine.root_device().ioport(player ? "GUNX2" : "GUNX1")->read() & 0xff) * visarea.width()) >> 8) + visarea.min_x;
|
||||
*y = (((machine.root_device().ioport(player ? "GUNY2" : "GUNY1")->read() & 0xff) * visarea.height()) >> 8) + visarea.min_y;
|
||||
x = (((ioport(player ? "GUNX2" : "GUNX1")->read() & 0xff) * visarea.width()) >> 8) + visarea.min_x;
|
||||
y = (((ioport(player ? "GUNY2" : "GUNY1")->read() & 0xff) * visarea.height()) >> 8) + visarea.min_y;
|
||||
}
|
||||
|
||||
|
||||
@ -157,12 +158,12 @@ TIMER_CALLBACK_MEMBER(tickee_state::setup_gun_interrupts)
|
||||
return;
|
||||
|
||||
/* generate interrupts for player 1's gun */
|
||||
get_crosshair_xy(machine(), 0, &beamx, &beamy);
|
||||
get_crosshair_xy(0, beamx, beamy);
|
||||
timer_set(m_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), TIMER_TRIGGER_GUN_INTERRUPT, 0);
|
||||
timer_set(m_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), TIMER_CLEAR_GUN_INTERRUPT, 0);
|
||||
|
||||
/* generate interrupts for player 2's gun */
|
||||
get_crosshair_xy(machine(), 1, &beamx, &beamy);
|
||||
get_crosshair_xy(1, beamx, beamy);
|
||||
timer_set(m_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), TIMER_TRIGGER_GUN_INTERRUPT, 1);
|
||||
timer_set(m_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), TIMER_CLEAR_GUN_INTERRUPT, 1);
|
||||
}
|
||||
|
@ -191,6 +191,7 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(hjingi_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(hjingi_lockout_w);
|
||||
DECLARE_WRITE8_MEMBER(hjingi_hopper_w);
|
||||
UINT8 hjingi_hopper_bit();
|
||||
DECLARE_READ8_MEMBER(hjingi_keyboard_0_r);
|
||||
DECLARE_READ8_MEMBER(hjingi_keyboard_1_r);
|
||||
DECLARE_WRITE8_MEMBER(yarunara_input_w);
|
||||
|
@ -95,6 +95,8 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(frame_w);
|
||||
DECLARE_READ8_MEMBER(fdt_r);
|
||||
DECLARE_WRITE8_MEMBER(fdt_w);
|
||||
static UINT8 static_rip_status_in(running_machine &machine);
|
||||
UINT8 rip_status_in();
|
||||
DECLARE_WRITE8_MEMBER(g_iobus_w);
|
||||
DECLARE_READ8_MEMBER(g_iobus_r);
|
||||
DECLARE_WRITE8_MEMBER(g_ioadd_w);
|
||||
|
@ -65,6 +65,8 @@ public:
|
||||
UINT8 m_grmatch_palcontrol;
|
||||
UINT8 m_grmatch_xscroll;
|
||||
rgb_t m_grmatch_palette[2][16];
|
||||
static void static_generate_interrupt(running_machine &machine, int state_num);
|
||||
void generate_interrupt(int state_num);
|
||||
DECLARE_WRITE8_MEMBER(itech8_nmi_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(blitter_w);
|
||||
DECLARE_WRITE8_MEMBER(rimrockn_bank_w);
|
||||
|
@ -128,6 +128,9 @@ public:
|
||||
read8_delegate m_megadrive_io_read_data_port_ptr;
|
||||
write16_delegate m_megadrive_io_write_data_port_ptr;
|
||||
|
||||
WRITE_LINE_MEMBER(genesis_vdp_sndirqline_callback_genesis_z80);
|
||||
WRITE_LINE_MEMBER(genesis_vdp_lv6irqline_callback_genesis_68k);
|
||||
WRITE_LINE_MEMBER(genesis_vdp_lv4irqline_callback_genesis_68k);
|
||||
|
||||
TIMER_CALLBACK_MEMBER( io_timeout_timer_callback );
|
||||
void megadrive_reset_io();
|
||||
@ -256,6 +259,10 @@ public:
|
||||
int m_segac2_sp_pal_lookup[4];
|
||||
void recompute_palette_tables();
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(genesis_vdp_sndirqline_callback_segac2);
|
||||
DECLARE_WRITE_LINE_MEMBER(genesis_vdp_lv6irqline_callback_segac2);
|
||||
DECLARE_WRITE_LINE_MEMBER(genesis_vdp_lv4irqline_callback_segac2);
|
||||
|
||||
DECLARE_WRITE16_MEMBER( segac2_upd7759_w );
|
||||
DECLARE_READ16_MEMBER( palette_r );
|
||||
DECLARE_WRITE16_MEMBER( palette_w );
|
||||
|
@ -101,6 +101,10 @@ public:
|
||||
DECLARE_READ16_MEMBER( genesis_vdp_r );
|
||||
DECLARE_WRITE16_MEMBER( genesis_vdp_w );
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(genesis_vdp_sndirqline_callback_segas18);
|
||||
DECLARE_WRITE_LINE_MEMBER(genesis_vdp_lv6irqline_callback_segas18);
|
||||
DECLARE_WRITE_LINE_MEMBER(genesis_vdp_lv4irqline_callback_segas18);
|
||||
|
||||
|
||||
// custom I/O
|
||||
DECLARE_READ16_MEMBER( ddcrew_custom_io_r );
|
||||
|
@ -22,9 +22,9 @@
|
||||
|
||||
#define DISASSEMBLE_MB_ROM 0 /* generate a disassembly of the mathbox ROMs */
|
||||
|
||||
#define IR_CPU_STATE(m) \
|
||||
#define IR_CPU_STATE() \
|
||||
logerror(\
|
||||
"%s, scanline: %d\n", (m).describe_context(), (m).primary_screen->vpos())
|
||||
"%s, scanline: %d\n", machine().describe_context(), m_screen->vpos())
|
||||
|
||||
|
||||
READ8_MEMBER(irobot_state::irobot_sharedmem_r)
|
||||
@ -63,7 +63,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(irobot_state::irobot_irvg_done_callback)
|
||||
WRITE8_MEMBER(irobot_state::irobot_statwr_w)
|
||||
{
|
||||
logerror("write %2x ", data);
|
||||
IR_CPU_STATE(machine());
|
||||
IR_CPU_STATE();
|
||||
|
||||
m_combase = m_comRAM[data >> 7];
|
||||
m_combase_mb = m_comRAM[(data >> 7) ^ 1];
|
||||
@ -81,7 +81,7 @@ WRITE8_MEMBER(irobot_state::irobot_statwr_w)
|
||||
logerror("vg start ");
|
||||
else
|
||||
logerror("vg start [busy!] ");
|
||||
IR_CPU_STATE(machine());
|
||||
IR_CPU_STATE();
|
||||
m_irvg_timer->adjust(attotime::from_msec(10));
|
||||
#endif
|
||||
m_irvg_running=1;
|
||||
@ -206,7 +206,7 @@ READ8_MEMBER(irobot_state::irobot_status_r)
|
||||
int d=0;
|
||||
|
||||
logerror("status read. ");
|
||||
IR_CPU_STATE(machine());
|
||||
IR_CPU_STATE();
|
||||
|
||||
if (!m_irmb_running) d |= 0x20;
|
||||
if (m_irvg_running) d |= 0x40;
|
||||
@ -800,12 +800,12 @@ default: case 0x3f: IXOR(irmb_din(curop), 0); bre
|
||||
{
|
||||
m_irmb_timer->adjust(attotime::from_hz(12000000) * icount);
|
||||
logerror("mb start ");
|
||||
IR_CPU_STATE(machine());
|
||||
IR_CPU_STATE();
|
||||
}
|
||||
else
|
||||
{
|
||||
logerror("mb start [busy!] ");
|
||||
IR_CPU_STATE(machine());
|
||||
IR_CPU_STATE();
|
||||
m_irmb_timer->adjust(attotime::from_hz(200) * icount);
|
||||
}
|
||||
#else
|
||||
|
@ -913,40 +913,37 @@ void md_base_state::megadriv_stop_scanline_timer()
|
||||
|
||||
|
||||
// this comes from the VDP on lines 240 (on) 241 (off) and is connected to the z80 irq 0
|
||||
void genesis_vdp_sndirqline_callback_genesis_z80(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(md_base_state::genesis_vdp_sndirqline_callback_genesis_z80)
|
||||
{
|
||||
md_base_state *md_state = machine.driver_data<md_base_state>();
|
||||
if (md_state->m_z80snd)
|
||||
if (m_z80snd)
|
||||
{
|
||||
if (state == true)
|
||||
if (state == ASSERT_LINE)
|
||||
{
|
||||
megadriv_z80_hold(machine);
|
||||
megadriv_z80_hold(machine());
|
||||
}
|
||||
else if (state == false)
|
||||
else if (state == CLEAR_LINE)
|
||||
{
|
||||
megadriv_z80_clear(machine);
|
||||
megadriv_z80_clear(machine());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this comes from the vdp, and is connected to 68k irq level 6 (main vbl interrupt)
|
||||
void genesis_vdp_lv6irqline_callback_genesis_68k(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(md_base_state::genesis_vdp_lv6irqline_callback_genesis_68k)
|
||||
{
|
||||
md_base_state *md_state = machine.driver_data<md_base_state>();
|
||||
if (state == true)
|
||||
md_state->m_maincpu->set_input_line(6, HOLD_LINE);
|
||||
if (state == ASSERT_LINE)
|
||||
m_maincpu->set_input_line(6, HOLD_LINE);
|
||||
else
|
||||
md_state->m_maincpu->set_input_line(6, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(6, CLEAR_LINE);
|
||||
}
|
||||
|
||||
// this comes from the vdp, and is connected to 68k irq level 4 (raster interrupt)
|
||||
void genesis_vdp_lv4irqline_callback_genesis_68k(running_machine &machine, bool state)
|
||||
WRITE_LINE_MEMBER(md_base_state::genesis_vdp_lv4irqline_callback_genesis_68k)
|
||||
{
|
||||
md_base_state *md_state = machine.driver_data<md_base_state>();
|
||||
if (state == true)
|
||||
md_state->m_maincpu->set_input_line(4, HOLD_LINE);
|
||||
if (state == ASSERT_LINE)
|
||||
m_maincpu->set_input_line(4, HOLD_LINE);
|
||||
else
|
||||
md_state->m_maincpu->set_input_line(4, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(4, CLEAR_LINE);
|
||||
}
|
||||
|
||||
/* Callback when the 68k takes an IRQ */
|
||||
@ -1012,11 +1009,9 @@ MACHINE_CONFIG_FRAGMENT( md_ntsc )
|
||||
MCFG_DEVICE_ADD("gen_vdp", SEGA_GEN_VDP, 0)
|
||||
MCFG_DEVICE_CONFIG( sms_vdp_ntsc_intf )
|
||||
MCFG_VIDEO_SET_SCREEN("megadriv")
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, genesis_vdp_sndirqline_callback_genesis_z80);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, genesis_vdp_lv6irqline_callback_genesis_68k);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, genesis_vdp_lv4irqline_callback_genesis_68k);
|
||||
|
||||
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, DEVCB2_WRITELINE(md_base_state, genesis_vdp_sndirqline_callback_genesis_z80));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, DEVCB2_WRITELINE(md_base_state, genesis_vdp_lv6irqline_callback_genesis_68k));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, DEVCB2_WRITELINE(md_base_state, genesis_vdp_lv4irqline_callback_genesis_68k));
|
||||
|
||||
MCFG_SCREEN_ADD("megadriv", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(60)
|
||||
@ -1066,9 +1061,9 @@ MACHINE_CONFIG_FRAGMENT( md_pal )
|
||||
MCFG_DEVICE_ADD("gen_vdp", SEGA_GEN_VDP, 0)
|
||||
MCFG_DEVICE_CONFIG( sms_vdp_pal_intf )
|
||||
MCFG_VIDEO_SET_SCREEN("megadriv")
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, genesis_vdp_sndirqline_callback_genesis_z80);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, genesis_vdp_lv6irqline_callback_genesis_68k);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, genesis_vdp_lv4irqline_callback_genesis_68k);
|
||||
sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(*device, DEVCB2_WRITELINE(md_base_state, genesis_vdp_sndirqline_callback_genesis_z80));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(*device, DEVCB2_WRITELINE(md_base_state, genesis_vdp_lv6irqline_callback_genesis_68k));
|
||||
sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(*device, DEVCB2_WRITELINE(md_base_state, genesis_vdp_lv4irqline_callback_genesis_68k));
|
||||
|
||||
MCFG_SCREEN_ADD("megadriv", RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(50)
|
||||
@ -1305,7 +1300,7 @@ void md_base_state::screen_eof_megadriv(screen_device &screen, bool state)
|
||||
{
|
||||
if (!m_vdp->m_use_alt_timing)
|
||||
{
|
||||
m_vdp->vdp_handle_eof(machine());
|
||||
m_vdp->vdp_handle_eof();
|
||||
megadriv_scanline_timer->adjust(attotime::zero);
|
||||
}
|
||||
}
|
||||
|
@ -20,32 +20,14 @@ int megadrive_total_scanlines;
|
||||
int megadrive_vblank_flag = 0;
|
||||
|
||||
|
||||
void genesis_vdp_sndirqline_callback_default(running_machine &machine, bool state)
|
||||
{
|
||||
// if you haven't actually hooked this up....
|
||||
fatalerror("m_genesis_vdp_sndirqline_callback should be connected to something!\n");
|
||||
}
|
||||
|
||||
void genesis_vdp_lv6irqline_callback_default(running_machine &machine, bool state)
|
||||
{
|
||||
// or this...
|
||||
fatalerror("m_genesis_vdp_lv6irqline_callback should be connected to something!\n");
|
||||
}
|
||||
|
||||
void genesis_vdp_lv4irqline_callback_default(running_machine &machine, bool state)
|
||||
{
|
||||
// or this...
|
||||
fatalerror("m_genesis_vdp_lv4irqline_callback should be connected to something!\n");
|
||||
}
|
||||
|
||||
const device_type SEGA_GEN_VDP = &device_creator<sega_genesis_vdp_device>;
|
||||
|
||||
sega_genesis_vdp_device::sega_genesis_vdp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: sega315_5124_device( mconfig, SEGA315_5246, "Sega Genesis VDP", tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, true, "sega_genesis_vdp", __FILE__)
|
||||
: sega315_5124_device( mconfig, SEGA315_5246, "Sega Genesis VDP", tag, owner, clock, SEGA315_5124_CRAM_SIZE, 0, true, "sega_genesis_vdp", __FILE__),
|
||||
m_genesis_vdp_sndirqline_callback(*this),
|
||||
m_genesis_vdp_lv6irqline_callback(*this),
|
||||
m_genesis_vdp_lv4irqline_callback(*this)
|
||||
{
|
||||
m_genesis_vdp_sndirqline_callback = genesis_vdp_sndirqline_callback_default;
|
||||
m_genesis_vdp_lv6irqline_callback = genesis_vdp_lv6irqline_callback_default;
|
||||
m_genesis_vdp_lv4irqline_callback = genesis_vdp_lv4irqline_callback_default;
|
||||
m_use_alt_timing = 0;
|
||||
m_palwrite_base = -1;
|
||||
}
|
||||
@ -53,54 +35,36 @@ sega_genesis_vdp_device::sega_genesis_vdp_device(const machine_config &mconfig,
|
||||
static TIMER_CALLBACK( megadriv_render_timer_callback )
|
||||
{
|
||||
sega_genesis_vdp_device* vdp = (sega_genesis_vdp_device*)ptr;
|
||||
vdp->genesis_render_scanline(machine);
|
||||
vdp->genesis_render_scanline();
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::vdp_handle_irq6_on_timer_callback(running_machine &machine, int param)
|
||||
void sega_genesis_vdp_device::vdp_handle_irq6_on_timer_callback(int param)
|
||||
{
|
||||
// megadrive_irq6_pending = 1;
|
||||
if (MEGADRIVE_REG01_IRQ6_ENABLE)
|
||||
m_genesis_vdp_lv6irqline_callback(machine, true);
|
||||
m_genesis_vdp_lv6irqline_callback(true);
|
||||
}
|
||||
|
||||
static TIMER_CALLBACK( irq6_on_timer_callback )
|
||||
{
|
||||
sega_genesis_vdp_device* vdp = (sega_genesis_vdp_device*)ptr;
|
||||
vdp->vdp_handle_irq6_on_timer_callback(machine, param);
|
||||
vdp->vdp_handle_irq6_on_timer_callback(param);
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::vdp_handle_irq4_on_timer_callback(running_machine &machine, int param)
|
||||
void sega_genesis_vdp_device::vdp_handle_irq4_on_timer_callback(int param)
|
||||
{
|
||||
m_genesis_vdp_lv4irqline_callback(machine, true);
|
||||
m_genesis_vdp_lv4irqline_callback(true);
|
||||
}
|
||||
|
||||
static TIMER_CALLBACK( irq4_on_timer_callback )
|
||||
{
|
||||
sega_genesis_vdp_device* vdp = (sega_genesis_vdp_device*)ptr;
|
||||
vdp->vdp_handle_irq4_on_timer_callback(machine, param);
|
||||
vdp->vdp_handle_irq4_on_timer_callback(param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void sega_genesis_vdp_device::set_genesis_vdp_sndirqline_callback(device_t &device, genesis_vdp_sndirqline_callback_func callback)
|
||||
{
|
||||
sega_genesis_vdp_device &dev = downcast<sega_genesis_vdp_device &>(device);
|
||||
dev.m_genesis_vdp_sndirqline_callback = callback;
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::set_genesis_vdp_lv6irqline_callback(device_t &device, genesis_vdp_lv6irqline_callback_func callback)
|
||||
{
|
||||
sega_genesis_vdp_device &dev = downcast<sega_genesis_vdp_device &>(device);
|
||||
dev.m_genesis_vdp_lv6irqline_callback = callback;
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::set_genesis_vdp_lv4irqline_callback(device_t &device, genesis_vdp_lv4irqline_callback_func callback)
|
||||
{
|
||||
sega_genesis_vdp_device &dev = downcast<sega_genesis_vdp_device &>(device);
|
||||
dev.m_genesis_vdp_lv4irqline_callback = callback;
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::set_genesis_vdp_alt_timing(device_t &device, int use_alt_timing)
|
||||
{
|
||||
sega_genesis_vdp_device &dev = downcast<sega_genesis_vdp_device &>(device);
|
||||
@ -118,6 +82,10 @@ void sega_genesis_vdp_device::set_genesis_vdp_palwrite_base(device_t &device, in
|
||||
|
||||
void sega_genesis_vdp_device::device_start()
|
||||
{
|
||||
m_genesis_vdp_sndirqline_callback.resolve_safe();
|
||||
m_genesis_vdp_lv6irqline_callback.resolve_safe();
|
||||
m_genesis_vdp_lv4irqline_callback.resolve_safe();
|
||||
|
||||
m_vram = auto_alloc_array(machine(), UINT16, 0x10000/2);
|
||||
m_cram = auto_alloc_array(machine(), UINT16, 0x80/2);
|
||||
m_vsram = auto_alloc_array(machine(), UINT16, 0x80/2);
|
||||
@ -270,7 +238,7 @@ void sega_genesis_vdp_device::vdp_vsram_write(UINT16 data)
|
||||
m_vdp_address &=0xffff;
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::write_cram_value(running_machine &machine, int offset, int data)
|
||||
void sega_genesis_vdp_device::write_cram_value(int offset, int data)
|
||||
{
|
||||
m_cram[offset] = data;
|
||||
|
||||
@ -283,9 +251,9 @@ void sega_genesis_vdp_device::write_cram_value(running_machine &machine, int off
|
||||
b = ((data >> 9)&0x07);
|
||||
if (m_palwrite_base != -1)
|
||||
{
|
||||
palette_set_color_rgb(machine,offset + m_palwrite_base ,pal3bit(r),pal3bit(g),pal3bit(b));
|
||||
palette_set_color_rgb(machine,offset + m_palwrite_base + 0x40 ,pal3bit(r>>1),pal3bit(g>>1),pal3bit(b>>1));
|
||||
palette_set_color_rgb(machine,offset + m_palwrite_base + 0x80 ,pal3bit((r>>1)|0x4),pal3bit((g>>1)|0x4),pal3bit((b>>1)|0x4));
|
||||
palette_set_color_rgb(machine(),offset + m_palwrite_base ,pal3bit(r),pal3bit(g),pal3bit(b));
|
||||
palette_set_color_rgb(machine(),offset + m_palwrite_base + 0x40 ,pal3bit(r>>1),pal3bit(g>>1),pal3bit(b>>1));
|
||||
palette_set_color_rgb(machine(),offset + m_palwrite_base + 0x80 ,pal3bit((r>>1)|0x4),pal3bit((g>>1)|0x4),pal3bit((b>>1)|0x4));
|
||||
}
|
||||
megadrive_vdp_palette_lookup[offset] = (b<<2) | (g<<7) | (r<<12);
|
||||
megadrive_vdp_palette_lookup_sprite[offset] = (b<<2) | (g<<7) | (r<<12);
|
||||
@ -294,12 +262,12 @@ void sega_genesis_vdp_device::write_cram_value(running_machine &machine, int off
|
||||
}
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::vdp_cram_write(running_machine &machine, UINT16 data)
|
||||
void sega_genesis_vdp_device::vdp_cram_write(UINT16 data)
|
||||
{
|
||||
int offset;
|
||||
offset = (m_vdp_address&0x7e)>>1;
|
||||
|
||||
write_cram_value(machine, offset,data);
|
||||
write_cram_value(offset,data);
|
||||
|
||||
m_vdp_address+=MEGADRIVE_REG0F_AUTO_INC;
|
||||
|
||||
@ -307,7 +275,7 @@ void sega_genesis_vdp_device::vdp_cram_write(running_machine &machine, UINT16 da
|
||||
}
|
||||
|
||||
|
||||
void sega_genesis_vdp_device::megadriv_vdp_data_port_w(running_machine &machine, int data)
|
||||
void sega_genesis_vdp_device::megadriv_vdp_data_port_w(int data)
|
||||
{
|
||||
m_vdp_command_pending = 0;
|
||||
|
||||
@ -375,7 +343,7 @@ void sega_genesis_vdp_device::megadriv_vdp_data_port_w(running_machine &machine,
|
||||
break;
|
||||
|
||||
case 0x0003:
|
||||
vdp_cram_write(machine, data);
|
||||
vdp_cram_write(data);
|
||||
break;
|
||||
|
||||
case 0x0004:
|
||||
@ -402,7 +370,7 @@ void sega_genesis_vdp_device::megadriv_vdp_data_port_w(running_machine &machine,
|
||||
|
||||
|
||||
|
||||
void sega_genesis_vdp_device::megadrive_vdp_set_register(running_machine &machine, int regnum, UINT8 value)
|
||||
void sega_genesis_vdp_device::megadrive_vdp_set_register(int regnum, UINT8 value)
|
||||
{
|
||||
m_vdp_regs[regnum] = value;
|
||||
|
||||
@ -417,9 +385,9 @@ void sega_genesis_vdp_device::megadrive_vdp_set_register(running_machine &machin
|
||||
if (megadrive_irq4_pending)
|
||||
{
|
||||
if (MEGADRIVE_REG0_IRQ4_ENABLE)
|
||||
m_genesis_vdp_lv4irqline_callback(machine, true);
|
||||
m_genesis_vdp_lv4irqline_callback(true);
|
||||
else
|
||||
m_genesis_vdp_lv4irqline_callback(machine, false);
|
||||
m_genesis_vdp_lv4irqline_callback(false);
|
||||
}
|
||||
|
||||
/* ??? Fatal Rewind needs this but I'm not sure it's accurate behavior
|
||||
@ -434,9 +402,9 @@ void sega_genesis_vdp_device::megadrive_vdp_set_register(running_machine &machin
|
||||
if (megadrive_irq6_pending)
|
||||
{
|
||||
if (MEGADRIVE_REG01_IRQ6_ENABLE )
|
||||
m_genesis_vdp_lv6irqline_callback(machine, true);
|
||||
m_genesis_vdp_lv6irqline_callback(true);
|
||||
else
|
||||
m_genesis_vdp_lv6irqline_callback(machine, false);
|
||||
m_genesis_vdp_lv6irqline_callback(false);
|
||||
|
||||
}
|
||||
|
||||
@ -448,9 +416,9 @@ void sega_genesis_vdp_device::megadrive_vdp_set_register(running_machine &machin
|
||||
|
||||
|
||||
// if (regnum == 0x0a)
|
||||
// mame_printf_debug("Set HINT Reload Register to %d on scanline %d\n",value, genesis_get_scanline_counter(machine));
|
||||
// mame_printf_debug("Set HINT Reload Register to %d on scanline %d\n",value, genesis_get_scanline_counter());
|
||||
|
||||
// mame_printf_debug("%s: Setting VDP Register #%02x to %02x\n",machine.describe_context(), regnum,value);
|
||||
// mame_printf_debug("%s: Setting VDP Register #%02x to %02x\n",machine().describe_context(), regnum,value);
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::update_m_vdp_code_and_address(void)
|
||||
@ -538,7 +506,7 @@ void sega_genesis_vdp_device::megadrive_do_insta_vram_copy(UINT32 source, UINT16
|
||||
}
|
||||
|
||||
/* Instant, but we pause the 68k a bit */
|
||||
void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vram_dma(running_machine &machine, UINT32 source,int length)
|
||||
void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vram_dma(UINT32 source,int length)
|
||||
{
|
||||
int count;
|
||||
|
||||
@ -549,7 +517,7 @@ void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vram_dma(running_machine
|
||||
|
||||
for (count = 0;count<(length>>1);count++)
|
||||
{
|
||||
vdp_vram_write(vdp_get_word_from_68k_mem(machine, source, *m_space68k));
|
||||
vdp_vram_write(vdp_get_word_from_68k_mem(machine(), source, *m_space68k));
|
||||
source+=2;
|
||||
if (source>0xffffff) source = 0xe00000;
|
||||
}
|
||||
@ -565,7 +533,7 @@ void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vram_dma(running_machine
|
||||
}
|
||||
|
||||
|
||||
void sega_genesis_vdp_device::megadrive_do_insta_68k_to_cram_dma(running_machine &machine,UINT32 source,UINT16 length)
|
||||
void sega_genesis_vdp_device::megadrive_do_insta_68k_to_cram_dma(UINT32 source,UINT16 length)
|
||||
{
|
||||
int count;
|
||||
|
||||
@ -575,7 +543,7 @@ void sega_genesis_vdp_device::megadrive_do_insta_68k_to_cram_dma(running_machine
|
||||
{
|
||||
//if (m_vdp_address>=0x80) return; // abandon
|
||||
|
||||
write_cram_value(machine, (m_vdp_address&0x7e)>>1, vdp_get_word_from_68k_mem(machine, source, *m_space68k));
|
||||
write_cram_value((m_vdp_address&0x7e)>>1, vdp_get_word_from_68k_mem(machine(), source, *m_space68k));
|
||||
source+=2;
|
||||
|
||||
if (source>0xffffff) source = 0xfe0000;
|
||||
@ -593,7 +561,7 @@ void sega_genesis_vdp_device::megadrive_do_insta_68k_to_cram_dma(running_machine
|
||||
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vsram_dma(running_machine &machine,UINT32 source,UINT16 length)
|
||||
void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vsram_dma(UINT32 source,UINT16 length)
|
||||
{
|
||||
int count;
|
||||
|
||||
@ -603,7 +571,7 @@ void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vsram_dma(running_machin
|
||||
{
|
||||
if (m_vdp_address>=0x80) return; // abandon
|
||||
|
||||
m_vsram[(m_vdp_address&0x7e)>>1] = vdp_get_word_from_68k_mem(machine, source, *m_space68k);
|
||||
m_vsram[(m_vdp_address&0x7e)>>1] = vdp_get_word_from_68k_mem(machine(), source, *m_space68k);
|
||||
source+=2;
|
||||
|
||||
if (source>0xffffff) source = 0xfe0000;
|
||||
@ -621,7 +589,7 @@ void sega_genesis_vdp_device::megadrive_do_insta_68k_to_vsram_dma(running_machin
|
||||
}
|
||||
|
||||
/* This can be simplified quite a lot.. */
|
||||
void sega_genesis_vdp_device::handle_dma_bits(running_machine &machine)
|
||||
void sega_genesis_vdp_device::handle_dma_bits()
|
||||
{
|
||||
#if 0
|
||||
if (m_vdp_code&0x20)
|
||||
@ -630,7 +598,7 @@ void sega_genesis_vdp_device::handle_dma_bits(running_machine &machine)
|
||||
UINT16 length;
|
||||
source = (MEGADRIVE_REG15_DMASOURCE1 | (MEGADRIVE_REG16_DMASOURCE2<<8) | ((MEGADRIVE_REG17_DMASOURCE3&0xff)<<16))<<1;
|
||||
length = (MEGADRIVE_REG13_DMALENGTH1 | (MEGADRIVE_REG14_DMALENGTH2<<8))<<1;
|
||||
mame_printf_debug("%s 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", machine.describe_context(), source, length, m_vdp_address,MEGADRIVE_REG01_DMA_ENABLE, m_vdp_code,MEGADRIVE_REG0F_AUTO_INC);
|
||||
mame_printf_debug("%s 68k DMAtran set source %06x length %04x dest %04x enabled %01x code %02x %02x\n", machine().describe_context(), source, length, m_vdp_address,MEGADRIVE_REG01_DMA_ENABLE, m_vdp_code,MEGADRIVE_REG0F_AUTO_INC);
|
||||
}
|
||||
#endif
|
||||
if (m_vdp_code==0x20)
|
||||
@ -648,7 +616,7 @@ void sega_genesis_vdp_device::handle_dma_bits(running_machine &machine)
|
||||
|
||||
/* The 68k is frozen during this transfer, it should be safe to throw a few cycles away and do 'instant' DMA because the 68k can't detect it being in progress (can the z80?) */
|
||||
//mame_printf_debug("68k->VRAM DMA transfer source %06x length %04x dest %04x enabled %01x\n", source, length, m_vdp_address,MEGADRIVE_REG01_DMA_ENABLE);
|
||||
if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vram_dma(machine,source,length);
|
||||
if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vram_dma(source,length);
|
||||
|
||||
}
|
||||
else if (MEGADRIVE_REG17_DMATYPE==0x2)
|
||||
@ -682,7 +650,7 @@ void sega_genesis_vdp_device::handle_dma_bits(running_machine &machine)
|
||||
|
||||
/* The 68k is frozen during this transfer, it should be safe to throw a few cycles away and do 'instant' DMA because the 68k can't detect it being in progress (can the z80?) */
|
||||
//mame_printf_debug("68k->CRAM DMA transfer source %06x length %04x dest %04x enabled %01x\n", source, length, m_vdp_address,MEGADRIVE_REG01_DMA_ENABLE);
|
||||
if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_cram_dma(machine,source,length);
|
||||
if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_cram_dma(source,length);
|
||||
}
|
||||
else if (MEGADRIVE_REG17_DMATYPE==0x2)
|
||||
{
|
||||
@ -709,7 +677,7 @@ void sega_genesis_vdp_device::handle_dma_bits(running_machine &machine)
|
||||
|
||||
/* The 68k is frozen during this transfer, it should be safe to throw a few cycles away and do 'instant' DMA because the 68k can't detect it being in progress (can the z80?) */
|
||||
//mame_printf_debug("68k->VSRAM DMA transfer source %06x length %04x dest %04x enabled %01x\n", source, length, m_vdp_address,MEGADRIVE_REG01_DMA_ENABLE);
|
||||
if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vsram_dma(machine,source,length);
|
||||
if (MEGADRIVE_REG01_DMA_ENABLE) megadrive_do_insta_68k_to_vsram_dma(source,length);
|
||||
}
|
||||
else if (MEGADRIVE_REG17_DMATYPE==0x2)
|
||||
{
|
||||
@ -752,7 +720,7 @@ void sega_genesis_vdp_device::handle_dma_bits(running_machine &machine)
|
||||
}
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::megadriv_vdp_ctrl_port_w(running_machine &machine, int data)
|
||||
void sega_genesis_vdp_device::megadriv_vdp_ctrl_port_w(int data)
|
||||
{
|
||||
// logerror("write to vdp control port %04x\n",data);
|
||||
m_vram_fill_pending = 0; // ??
|
||||
@ -764,7 +732,7 @@ void sega_genesis_vdp_device::megadriv_vdp_ctrl_port_w(running_machine &machine,
|
||||
m_vdp_command_part2 = data;
|
||||
|
||||
update_m_vdp_code_and_address();
|
||||
handle_dma_bits(machine);
|
||||
handle_dma_bits();
|
||||
|
||||
//logerror("VDP Write Part 2 setting Code %02x Address %04x\n",m_vdp_code, m_vdp_address);
|
||||
|
||||
@ -778,7 +746,7 @@ void sega_genesis_vdp_device::megadriv_vdp_ctrl_port_w(running_machine &machine,
|
||||
|
||||
if (regnum &0x20) mame_printf_debug("reg error\n");
|
||||
|
||||
megadrive_vdp_set_register(machine, regnum&0x1f,value);
|
||||
megadrive_vdp_set_register(regnum&0x1f,value);
|
||||
m_vdp_code = 0;
|
||||
m_vdp_address = 0;
|
||||
}
|
||||
@ -809,13 +777,13 @@ WRITE16_MEMBER( sega_genesis_vdp_device::megadriv_vdp_w )
|
||||
data = (data&0xff00) | data>>8;
|
||||
// mame_printf_debug("8-bit write VDP data port access, offset %04x data %04x mem_mask %04x\n",offset,data,mem_mask);
|
||||
}
|
||||
megadriv_vdp_data_port_w(space.machine(), data);
|
||||
megadriv_vdp_data_port_w(data);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
case 0x06:
|
||||
if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit write VDP control port access, offset %04x data %04x mem_mask %04x\n",offset,data,mem_mask);
|
||||
megadriv_vdp_ctrl_port_w(space.machine(), data);
|
||||
megadriv_vdp_ctrl_port_w(data);
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
@ -831,7 +799,7 @@ WRITE16_MEMBER( sega_genesis_vdp_device::megadriv_vdp_w )
|
||||
case 0x16:
|
||||
{
|
||||
// accessed by either segapsg_device or sn76496_device
|
||||
sn76496_base_device *sn = space.machine().device<sn76496_base_device>(":snsnd");
|
||||
sn76496_base_device *sn = machine().device<sn76496_base_device>(":snsnd");
|
||||
if (ACCESSING_BITS_0_7) sn->write(space, 0, data & 0xff);
|
||||
//if (ACCESSING_BITS_8_15) sn->write(space, 0, (data>>8) & 0xff);
|
||||
break;
|
||||
@ -857,11 +825,11 @@ UINT16 sega_genesis_vdp_device::vdp_cram_r(void)
|
||||
return m_cram[(m_vdp_address&0x7e)>>1];
|
||||
}
|
||||
|
||||
UINT16 sega_genesis_vdp_device::megadriv_vdp_data_port_r(running_machine &machine)
|
||||
UINT16 sega_genesis_vdp_device::megadriv_vdp_data_port_r()
|
||||
{
|
||||
UINT16 retdata=0;
|
||||
|
||||
//return machine.rand();
|
||||
//return machine().rand();
|
||||
|
||||
m_vdp_command_pending = 0;
|
||||
|
||||
@ -875,12 +843,12 @@ UINT16 sega_genesis_vdp_device::megadriv_vdp_data_port_r(running_machine &machin
|
||||
|
||||
case 0x0001:
|
||||
logerror("Attempting to READ from DATA PORT in VRAM WRITE MODE\n");
|
||||
retdata = machine.rand();
|
||||
retdata = machine().rand();
|
||||
break;
|
||||
|
||||
case 0x0003:
|
||||
logerror("Attempting to READ from DATA PORT in CRAM WRITE MODE\n");
|
||||
retdata = machine.rand();
|
||||
retdata = machine().rand();
|
||||
break;
|
||||
|
||||
case 0x0004:
|
||||
@ -901,7 +869,7 @@ UINT16 sega_genesis_vdp_device::megadriv_vdp_data_port_r(running_machine &machin
|
||||
|
||||
default:
|
||||
logerror("Attempting to READ from DATA PORT in #UNDEFINED# MODE\n");
|
||||
retdata = machine.rand();
|
||||
retdata = machine().rand();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -974,7 +942,7 @@ PAL, 256x224
|
||||
|
||||
|
||||
|
||||
UINT16 sega_genesis_vdp_device::megadriv_vdp_ctrl_port_r(running_machine &machine)
|
||||
UINT16 sega_genesis_vdp_device::megadriv_vdp_ctrl_port_r()
|
||||
{
|
||||
/* Battletoads is very fussy about the vblank flag
|
||||
it wants it to be 1. in scanline 224 */
|
||||
@ -996,7 +964,7 @@ UINT16 sega_genesis_vdp_device::megadriv_vdp_ctrl_port_r(running_machine &machin
|
||||
int fifo_empty = 1;
|
||||
int fifo_full = 0;
|
||||
|
||||
UINT16 hpos = get_hposition(machine);
|
||||
UINT16 hpos = get_hposition();
|
||||
|
||||
if (hpos>400) megadrive_hblank_flag = 1;
|
||||
if (hpos>460) megadrive_hblank_flag = 0;
|
||||
@ -1139,7 +1107,7 @@ static const UINT8 vc_pal_240[] =
|
||||
};
|
||||
|
||||
|
||||
UINT16 sega_genesis_vdp_device::get_hposition(running_machine &machine)
|
||||
UINT16 sega_genesis_vdp_device::get_hposition()
|
||||
{
|
||||
UINT16 value4;
|
||||
|
||||
@ -1161,29 +1129,29 @@ UINT16 sega_genesis_vdp_device::get_hposition(running_machine &machine)
|
||||
}
|
||||
else
|
||||
{
|
||||
value4 = machine.primary_screen->hpos();
|
||||
value4 = m_screen->hpos();
|
||||
}
|
||||
|
||||
return value4;
|
||||
}
|
||||
|
||||
int sega_genesis_vdp_device::genesis_get_scanline_counter(running_machine &machine)
|
||||
int sega_genesis_vdp_device::genesis_get_scanline_counter()
|
||||
{
|
||||
if (!m_use_alt_timing)
|
||||
return m_scanline_counter;
|
||||
else
|
||||
return machine.primary_screen->vpos();
|
||||
return m_screen->vpos();
|
||||
}
|
||||
|
||||
|
||||
UINT16 sega_genesis_vdp_device::megadriv_read_hv_counters(running_machine &machine)
|
||||
UINT16 sega_genesis_vdp_device::megadriv_read_hv_counters()
|
||||
{
|
||||
/* Bubble and Squeek wants vcount=0xe0 */
|
||||
/* Dracula is very sensitive to this */
|
||||
/* Marvel Land is sensitive to this */
|
||||
|
||||
int vpos = genesis_get_scanline_counter(machine);
|
||||
UINT16 hpos = get_hposition(machine);
|
||||
int vpos = genesis_get_scanline_counter();
|
||||
UINT16 hpos = get_hposition();
|
||||
|
||||
// if (hpos>424) vpos++; // fixes dracula, breaks road rash
|
||||
if (hpos>460) vpos++; // when does vpos increase.. also on sms, check game gear manual..
|
||||
@ -1223,15 +1191,15 @@ READ16_MEMBER( sega_genesis_vdp_device::megadriv_vdp_r )
|
||||
case 0x00:
|
||||
case 0x02:
|
||||
if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read data port access, offset %04x mem_mask %04x\n",offset,mem_mask);
|
||||
retvalue = megadriv_vdp_data_port_r(space.machine());
|
||||
retvalue = megadriv_vdp_data_port_r();
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
case 0x06:
|
||||
// if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read control port access, offset %04x mem_mask %04x\n",offset,mem_mask);
|
||||
retvalue = megadriv_vdp_ctrl_port_r(space.machine());
|
||||
// retvalue = space.machine().rand();
|
||||
// mame_printf_debug("%06x: Read Control Port at scanline %d hpos %d (return %04x)\n",space.device().safe_pc(),genesis_get_scanline_counter(machine), get_hposition(space.machine()),retvalue);
|
||||
retvalue = megadriv_vdp_ctrl_port_r();
|
||||
// retvalue = machine().rand();
|
||||
// mame_printf_debug("%06x: Read Control Port at scanline %d hpos %d (return %04x)\n",space.device().safe_pc(),genesis_get_scanline_counter(), get_hposition(),retvalue);
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
@ -1239,9 +1207,9 @@ READ16_MEMBER( sega_genesis_vdp_device::megadriv_vdp_r )
|
||||
case 0x0c:
|
||||
case 0x0e:
|
||||
// if ((!ACCESSING_BITS_8_15) || (!ACCESSING_BITS_0_7)) mame_printf_debug("8-bit VDP read HV counter port access, offset %04x mem_mask %04x\n",offset,mem_mask);
|
||||
retvalue = megadriv_read_hv_counters(space.machine());
|
||||
// retvalue = space.machine().rand();
|
||||
// mame_printf_debug("%06x: Read HV counters at scanline %d hpos %d (return %04x)\n",space.device().safe_pc(),genesis_get_scanline_counter(machine), get_hposition(space.machine()),retvalue);
|
||||
retvalue = megadriv_read_hv_counters();
|
||||
// retvalue = machine().rand();
|
||||
// mame_printf_debug("%06x: Read HV counters at scanline %d hpos %d (return %04x)\n",space.device().safe_pc(),genesis_get_scanline_counter(), get_hposition(),retvalue);
|
||||
break;
|
||||
|
||||
case 0x10:
|
||||
@ -1561,7 +1529,7 @@ void sega_genesis_vdp_device::genesis_render_videoline_to_videobuffer(int scanli
|
||||
|
||||
//mame_printf_debug("screenwidth %d\n",screenwidth);
|
||||
|
||||
//base_w = Machine->rand()&0xff;
|
||||
//base_w = machine().rand()&0xff;
|
||||
|
||||
/* Calculate Exactly where we're going to draw the Window, and if the Window Bug applies */
|
||||
window_is_bugged = 0;
|
||||
@ -2509,9 +2477,9 @@ void sega_genesis_vdp_device::genesis_render_videoline_to_videobuffer(int scanli
|
||||
|
||||
|
||||
/* This converts our render buffer to real screen colours */
|
||||
void sega_genesis_vdp_device::genesis_render_videobuffer_to_screenbuffer(running_machine &machine, int scanline)
|
||||
void sega_genesis_vdp_device::genesis_render_videobuffer_to_screenbuffer(int scanline)
|
||||
{
|
||||
sega_32x_device *_32xdev = machine.device<sega_32x_device>("sega32x"); // take this out of the VDP eventually
|
||||
sega_32x_device *_32xdev = machine().device<sega_32x_device>("sega32x"); // take this out of the VDP eventually
|
||||
UINT16 *lineptr;
|
||||
|
||||
if (!m_use_alt_timing)
|
||||
@ -2591,7 +2559,7 @@ void sega_genesis_vdp_device::genesis_render_videobuffer_to_screenbuffer(running
|
||||
case 0x1a000: // (sprite)shadow set, highlight set - not possible
|
||||
case 0x1e000: // (sprite)shadow set, highlight set, normal set, not possible
|
||||
default:
|
||||
lineptr[x] = m_render_line_raw[x] |= (machine.rand() & 0x3f);
|
||||
lineptr[x] = m_render_line_raw[x] |= (machine().rand() & 0x3f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2603,20 +2571,20 @@ void sega_genesis_vdp_device::genesis_render_videobuffer_to_screenbuffer(running
|
||||
}
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::genesis_render_scanline(running_machine &machine)
|
||||
void sega_genesis_vdp_device::genesis_render_scanline()
|
||||
{
|
||||
int scanline = genesis_get_scanline_counter(machine);
|
||||
int scanline = genesis_get_scanline_counter();
|
||||
|
||||
if (scanline >= 0 && scanline < m_visible_scanlines)
|
||||
{
|
||||
//if (MEGADRIVE_REG01_DMA_ENABLE==0) mame_printf_debug("off\n");
|
||||
genesis_render_spriteline_to_spritebuffer(genesis_get_scanline_counter(machine));
|
||||
genesis_render_spriteline_to_spritebuffer(genesis_get_scanline_counter());
|
||||
genesis_render_videoline_to_videobuffer(scanline);
|
||||
genesis_render_videobuffer_to_screenbuffer(machine, scanline);
|
||||
genesis_render_videobuffer_to_screenbuffer(scanline);
|
||||
}
|
||||
}
|
||||
|
||||
void sega_genesis_vdp_device::vdp_handle_scanline_callback(running_machine &machine, int scanline)
|
||||
void sega_genesis_vdp_device::vdp_handle_scanline_callback(int scanline)
|
||||
{
|
||||
/* Compensate for some rounding errors
|
||||
|
||||
@ -2624,18 +2592,18 @@ void sega_genesis_vdp_device::vdp_handle_scanline_callback(running_machine &mach
|
||||
to rounding errors in the timer calculation we're not quite there. Let's assume we are
|
||||
still in the previous scanline for now.
|
||||
*/
|
||||
sega_32x_device *_32xdev = machine.device<sega_32x_device>("sega32x"); // take this out of the VDP eventually
|
||||
sega_32x_device *_32xdev = machine().device<sega_32x_device>("sega32x"); // take this out of the VDP eventually
|
||||
|
||||
|
||||
if (genesis_get_scanline_counter(machine) != (megadrive_total_scanlines - 1))
|
||||
if (genesis_get_scanline_counter() != (megadrive_total_scanlines - 1))
|
||||
{
|
||||
if (!m_use_alt_timing) m_scanline_counter++;
|
||||
// mame_printf_debug("scanline %d\n",genesis_get_scanline_counter(machine));
|
||||
// mame_printf_debug("scanline %d\n",genesis_get_scanline_counter());
|
||||
megadriv_render_timer->adjust(attotime::from_usec(1));
|
||||
|
||||
if (genesis_get_scanline_counter(machine) == m_irq6_scanline)
|
||||
if (genesis_get_scanline_counter() == m_irq6_scanline)
|
||||
{
|
||||
// mame_printf_debug("x %d",genesis_get_scanline_counter(machine));
|
||||
// mame_printf_debug("x %d",genesis_get_scanline_counter());
|
||||
irq6_on_timer->adjust(attotime::from_usec(6));
|
||||
megadrive_irq6_pending = 1;
|
||||
megadrive_vblank_flag = 1;
|
||||
@ -2650,10 +2618,10 @@ void sega_genesis_vdp_device::vdp_handle_scanline_callback(running_machine &mach
|
||||
if (_32xdev) _32xdev->_32x_check_framebuffer_swap(m_scanline_counter >= m_irq6_scanline);
|
||||
|
||||
|
||||
// if (genesis_get_scanline_counter(machine)==0) m_irq4counter = MEGADRIVE_REG0A_HINT_VALUE;
|
||||
// if (genesis_get_scanline_counter()==0) m_irq4counter = MEGADRIVE_REG0A_HINT_VALUE;
|
||||
// m_irq4counter = MEGADRIVE_REG0A_HINT_VALUE;
|
||||
|
||||
if (genesis_get_scanline_counter(machine)<=224)
|
||||
if (genesis_get_scanline_counter()<=224)
|
||||
{
|
||||
m_irq4counter--;
|
||||
|
||||
@ -2667,7 +2635,7 @@ void sega_genesis_vdp_device::vdp_handle_scanline_callback(running_machine &mach
|
||||
if (MEGADRIVE_REG0_IRQ4_ENABLE)
|
||||
{
|
||||
irq4_on_timer->adjust(attotime::from_usec(1));
|
||||
//mame_printf_debug("irq4 on scanline %d reload %d\n",genesis_get_scanline_counter(machine),MEGADRIVE_REG0A_HINT_VALUE);
|
||||
//mame_printf_debug("irq4 on scanline %d reload %d\n",genesis_get_scanline_counter(),MEGADRIVE_REG0A_HINT_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2677,19 +2645,19 @@ void sega_genesis_vdp_device::vdp_handle_scanline_callback(running_machine &mach
|
||||
else m_irq4counter=MEGADRIVE_REG0A_HINT_VALUE;
|
||||
}
|
||||
|
||||
//if (genesis_get_scanline_counter(machine)==0) irq4_on_timer->adjust(attotime::from_usec(2));
|
||||
//if (genesis_get_scanline_counter()==0) irq4_on_timer->adjust(attotime::from_usec(2));
|
||||
|
||||
|
||||
if (_32xdev) _32xdev->_32x_scanline_cb1(m_scanline_counter);
|
||||
|
||||
|
||||
if (genesis_get_scanline_counter(machine) == m_z80irq_scanline)
|
||||
if (genesis_get_scanline_counter() == m_z80irq_scanline)
|
||||
{
|
||||
m_genesis_vdp_sndirqline_callback(machine, true);
|
||||
m_genesis_vdp_sndirqline_callback(true);
|
||||
}
|
||||
if (genesis_get_scanline_counter(machine) == m_z80irq_scanline + 1)
|
||||
if (genesis_get_scanline_counter() == m_z80irq_scanline + 1)
|
||||
{
|
||||
m_genesis_vdp_sndirqline_callback(machine, false);
|
||||
m_genesis_vdp_sndirqline_callback(false);
|
||||
}
|
||||
}
|
||||
else /* pretend we're still on the same scanline to compensate for rounding errors */
|
||||
@ -2702,9 +2670,9 @@ void sega_genesis_vdp_device::vdp_handle_scanline_callback(running_machine &mach
|
||||
|
||||
|
||||
|
||||
void sega_genesis_vdp_device::vdp_handle_eof(running_machine &machine)
|
||||
void sega_genesis_vdp_device::vdp_handle_eof()
|
||||
{
|
||||
sega_32x_device *_32xdev = machine.device<sega_32x_device>("sega32x"); // take this out of the VDP eventually
|
||||
sega_32x_device *_32xdev = machine().device<sega_32x_device>("sega32x"); // take this out of the VDP eventually
|
||||
|
||||
rectangle visarea;
|
||||
int scr_width = 320;
|
||||
@ -2756,7 +2724,7 @@ void sega_genesis_vdp_device::vdp_handle_eof(running_machine &machine)
|
||||
|
||||
visarea.set(0, scr_width - 1, 0, m_visible_scanlines - 1);
|
||||
|
||||
machine.primary_screen->configure(480, megadrive_total_scanlines, visarea, machine.primary_screen->frame_period().attoseconds);
|
||||
m_screen->configure(480, megadrive_total_scanlines, visarea, m_screen->frame_period().attoseconds);
|
||||
|
||||
|
||||
if(_32xdev) _32xdev->m_32x_hcount_compare_val = -1;
|
||||
@ -2771,13 +2739,13 @@ TIMER_DEVICE_CALLBACK( megadriv_scanline_timer_callback )
|
||||
if (!vdp->m_use_alt_timing)
|
||||
{
|
||||
timer.machine().scheduler().synchronize();
|
||||
vdp->vdp_handle_scanline_callback(timer.machine(), param);
|
||||
vdp->vdp_handle_scanline_callback(param);
|
||||
|
||||
megadriv_scanline_timer->adjust(attotime::from_hz(vdp->get_framerate()) / megadrive_total_scanlines);
|
||||
}
|
||||
else
|
||||
{
|
||||
vdp->vdp_handle_scanline_callback(timer.machine(), param);
|
||||
vdp->vdp_handle_scanline_callback(param);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2790,12 +2758,12 @@ TIMER_DEVICE_CALLBACK( megadriv_scanline_timer_callback_alt_timing )
|
||||
if (param==0)
|
||||
{
|
||||
//printf("where are we? %d %d\n", m_screen->vpos(), vdp->screen().hpos());
|
||||
vdp->vdp_handle_eof(timer.machine());
|
||||
vdp->vdp_handle_eof();
|
||||
//vdp->vdp_clear_bitmap();
|
||||
}
|
||||
|
||||
|
||||
vdp->vdp_handle_scanline_callback(timer.machine(), param);
|
||||
vdp->vdp_handle_scanline_callback(param);
|
||||
|
||||
int vpos = vdp->screen().vpos();
|
||||
if (vpos > 0)
|
||||
|
@ -146,10 +146,6 @@
|
||||
#define MEGADRIVE_REG17_UNUSED ((m_vdp_regs[0x17]&0x3f)>>0)
|
||||
|
||||
|
||||
typedef void (*genesis_vdp_sndirqline_callback_func)(running_machine &machine, bool state);
|
||||
typedef void (*genesis_vdp_lv6irqline_callback_func)(running_machine &machine, bool state);
|
||||
typedef void (*genesis_vdp_lv4irqline_callback_func)(running_machine &machine, bool state);
|
||||
|
||||
TIMER_DEVICE_CALLBACK( megadriv_scanline_timer_callback_alt_timing );
|
||||
|
||||
UINT16 vdp_get_word_from_68k_mem_default(running_machine &machine, UINT32 source, address_space & space68k);
|
||||
@ -160,9 +156,9 @@ class sega_genesis_vdp_device : public sega315_5124_device
|
||||
public:
|
||||
sega_genesis_vdp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void set_genesis_vdp_sndirqline_callback(device_t &device, genesis_vdp_sndirqline_callback_func callback);
|
||||
static void set_genesis_vdp_lv6irqline_callback(device_t &device, genesis_vdp_lv6irqline_callback_func callback);
|
||||
static void set_genesis_vdp_lv4irqline_callback(device_t &device, genesis_vdp_lv4irqline_callback_func callback);
|
||||
template<class _Object> static devcb2_base &set_genesis_vdp_sndirqline_callback(device_t &device, _Object object) { return downcast<sega_genesis_vdp_device &>(device).m_genesis_vdp_sndirqline_callback.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_genesis_vdp_lv6irqline_callback(device_t &device, _Object object) { return downcast<sega_genesis_vdp_device &>(device).m_genesis_vdp_lv6irqline_callback.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_genesis_vdp_lv4irqline_callback(device_t &device, _Object object) { return downcast<sega_genesis_vdp_device &>(device).m_genesis_vdp_lv4irqline_callback.set_callback(object); }
|
||||
static void set_genesis_vdp_alt_timing(device_t &device, int use_alt_timing);
|
||||
static void set_genesis_vdp_palwrite_base(device_t &device, int palwrite_base);
|
||||
|
||||
@ -173,14 +169,14 @@ public:
|
||||
DECLARE_READ16_MEMBER( megadriv_vdp_r );
|
||||
DECLARE_WRITE16_MEMBER( megadriv_vdp_w );
|
||||
|
||||
int genesis_get_scanline_counter(running_machine &machine);
|
||||
int genesis_get_scanline_counter();
|
||||
|
||||
|
||||
void genesis_render_scanline(running_machine &machine);
|
||||
void vdp_handle_scanline_callback(running_machine &machine, int scanline);
|
||||
void vdp_handle_irq6_on_timer_callback(running_machine &machine, int param);
|
||||
void vdp_handle_irq4_on_timer_callback(running_machine &machine, int param);
|
||||
void vdp_handle_eof(running_machine &machine);
|
||||
void genesis_render_scanline();
|
||||
void vdp_handle_scanline_callback(int scanline);
|
||||
void vdp_handle_irq6_on_timer_callback(int param);
|
||||
void vdp_handle_irq4_on_timer_callback(int param);
|
||||
void vdp_handle_eof();
|
||||
void device_reset_old();
|
||||
void vdp_clear_irq6_pending(void) { megadrive_irq6_pending = 0; };
|
||||
void vdp_clear_irq4_pending(void) { megadrive_irq4_pending = 0; };
|
||||
@ -209,9 +205,9 @@ protected:
|
||||
virtual void device_reset();
|
||||
|
||||
// called when we hit 240 and 241 (used to control the z80 irq line on genesis, or the main irq on c2)
|
||||
genesis_vdp_sndirqline_callback_func m_genesis_vdp_sndirqline_callback;
|
||||
genesis_vdp_lv6irqline_callback_func m_genesis_vdp_lv6irqline_callback;
|
||||
genesis_vdp_lv6irqline_callback_func m_genesis_vdp_lv4irqline_callback;
|
||||
devcb2_write_line m_genesis_vdp_sndirqline_callback;
|
||||
devcb2_write_line m_genesis_vdp_lv6irqline_callback;
|
||||
devcb2_write_line m_genesis_vdp_lv4irqline_callback;
|
||||
|
||||
private:
|
||||
|
||||
@ -257,38 +253,37 @@ private:
|
||||
emu_timer* irq4_on_timer;
|
||||
emu_timer* megadriv_render_timer;
|
||||
|
||||
|
||||
UINT16 vdp_vram_r(void);
|
||||
UINT16 vdp_vsram_r(void);
|
||||
UINT16 vdp_cram_r(void);
|
||||
|
||||
void megadrive_do_insta_68k_to_cram_dma(running_machine &machine,UINT32 source,UINT16 length);
|
||||
void megadrive_do_insta_68k_to_vsram_dma(running_machine &machine,UINT32 source,UINT16 length);
|
||||
void megadrive_do_insta_68k_to_vram_dma(running_machine &machine, UINT32 source,int length);
|
||||
void megadrive_do_insta_68k_to_cram_dma(UINT32 source,UINT16 length);
|
||||
void megadrive_do_insta_68k_to_vsram_dma(UINT32 source,UINT16 length);
|
||||
void megadrive_do_insta_68k_to_vram_dma(UINT32 source,int length);
|
||||
void megadrive_do_insta_vram_copy(UINT32 source, UINT16 length);
|
||||
|
||||
void vdp_vram_write(UINT16 data);
|
||||
void vdp_cram_write(running_machine &machine, UINT16 data);
|
||||
void write_cram_value(running_machine &machine, int offset, int data);
|
||||
void vdp_cram_write(UINT16 data);
|
||||
void write_cram_value(int offset, int data);
|
||||
void vdp_vsram_write(UINT16 data);
|
||||
|
||||
void megadrive_vdp_set_register(running_machine &machine, int regnum, UINT8 value);
|
||||
void megadrive_vdp_set_register(int regnum, UINT8 value);
|
||||
|
||||
void handle_dma_bits(running_machine &machine);
|
||||
void handle_dma_bits();
|
||||
|
||||
UINT16 get_hposition(running_machine &machine);
|
||||
UINT16 megadriv_read_hv_counters(running_machine &machine);
|
||||
UINT16 get_hposition();
|
||||
UINT16 megadriv_read_hv_counters();
|
||||
|
||||
UINT16 megadriv_vdp_ctrl_port_r(running_machine &machine);
|
||||
UINT16 megadriv_vdp_data_port_r(running_machine &machine);
|
||||
void megadriv_vdp_data_port_w(running_machine &machine, int data);
|
||||
void megadriv_vdp_ctrl_port_w(running_machine &machine, int data);
|
||||
UINT16 megadriv_vdp_ctrl_port_r();
|
||||
UINT16 megadriv_vdp_data_port_r();
|
||||
void megadriv_vdp_data_port_w(int data);
|
||||
void megadriv_vdp_ctrl_port_w(int data);
|
||||
void update_m_vdp_code_and_address(void);
|
||||
|
||||
|
||||
void genesis_render_spriteline_to_spritebuffer(int scanline);
|
||||
void genesis_render_videoline_to_videobuffer(int scanline);
|
||||
void genesis_render_videobuffer_to_screenbuffer(running_machine &machine, int scanline);
|
||||
void genesis_render_videobuffer_to_screenbuffer(int scanline);
|
||||
|
||||
/* variables used during emulation - not saved */
|
||||
UINT8* m_sprite_renderline;
|
||||
|
Loading…
Reference in New Issue
Block a user