mirror of
https://github.com/holub/mame
synced 2025-04-25 01:40:16 +03:00
cleanup of mpu4vid (nw)
This commit is contained in:
parent
d5ccd8d282
commit
6173a2004f
@ -299,17 +299,19 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(vid_o3_callback);
|
||||
DECLARE_READ8_MEMBER(pia_ic5_porta_track_r);
|
||||
void mpu4vid_char_cheat( int address);
|
||||
DECLARE_WRITE_LINE_MEMBER(update_mpu68_interrupts);
|
||||
DECLARE_READ16_MEMBER( mpu4_vid_vidram_r );
|
||||
DECLARE_WRITE16_MEMBER( mpu4_vid_vidram_w );
|
||||
DECLARE_WRITE16_MEMBER( ef9369_w );
|
||||
DECLARE_READ16_MEMBER( ef9369_r );
|
||||
DECLARE_WRITE16_MEMBER( bt471_w );
|
||||
DECLARE_READ16_MEMBER( bt471_r );
|
||||
DECLARE_WRITE16_MEMBER( characteriser16_w );
|
||||
DECLARE_READ16_MEMBER( characteriser16_r );
|
||||
DECLARE_WRITE16_MEMBER( bwb_characteriser16_w );
|
||||
DECLARE_READ16_MEMBER( bwb_characteriser16_r );
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
static DECLARE_READ16_HANDLER( characteriser16_r );
|
||||
static DECLARE_WRITE16_HANDLER( characteriser16_w );
|
||||
|
||||
static DECLARE_READ16_HANDLER( bwb_characteriser16_r );
|
||||
static DECLARE_WRITE16_HANDLER( bwb_characteriser16_w );
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Interrupt system
|
||||
@ -331,12 +333,11 @@ static DECLARE_WRITE16_HANDLER( bwb_characteriser16_w );
|
||||
*/
|
||||
|
||||
|
||||
static void update_mpu68_interrupts(running_machine &machine)
|
||||
WRITE_LINE_MEMBER(mpu4vid_state::update_mpu68_interrupts)
|
||||
{
|
||||
mpu4vid_state *state = machine.driver_data<mpu4vid_state>();
|
||||
state->m_videocpu->set_input_line(1, state->m_m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
state->m_videocpu->set_input_line(2, state->m_m6850_irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
state->m_videocpu->set_input_line(3, state->m_scn2674->get_irq_state() ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_videocpu->set_input_line(1, m_m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_videocpu->set_input_line(2, m_m6850_irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_videocpu->set_input_line(3, m_scn2674->get_irq_state() ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
/* Communications with 6809 board */
|
||||
@ -413,7 +414,7 @@ WRITE_LINE_MEMBER(mpu4vid_state::m68k_acia_irq)
|
||||
{
|
||||
m_m6809_acia_cts = state;
|
||||
m_m6850_irq_state = state;
|
||||
update_mpu68_interrupts(machine());
|
||||
update_mpu68_interrupts(1);
|
||||
}
|
||||
|
||||
static ACIA6850_INTERFACE( m68k_acia_if )
|
||||
@ -432,7 +433,7 @@ static ACIA6850_INTERFACE( m68k_acia_if )
|
||||
WRITE_LINE_MEMBER(mpu4vid_state::cpu1_ptm_irq)
|
||||
{
|
||||
m_m6840_irq_state = state;
|
||||
update_mpu68_interrupts(machine());
|
||||
update_mpu68_interrupts(1);
|
||||
}
|
||||
|
||||
|
||||
@ -537,22 +538,20 @@ UINT32 mpu4vid_state::screen_update_mpu4_vid(screen_device &screen, bitmap_rgb32
|
||||
}
|
||||
|
||||
|
||||
static READ16_HANDLER( mpu4_vid_vidram_r )
|
||||
READ16_MEMBER(mpu4vid_state::mpu4_vid_vidram_r )
|
||||
{
|
||||
mpu4vid_state *state = space.machine().driver_data<mpu4vid_state>();
|
||||
return state->m_vid_vidram[offset];
|
||||
return m_vid_vidram[offset];
|
||||
}
|
||||
|
||||
|
||||
static WRITE16_HANDLER( mpu4_vid_vidram_w )
|
||||
WRITE16_MEMBER(mpu4vid_state::mpu4_vid_vidram_w )
|
||||
{
|
||||
mpu4vid_state *state = space.machine().driver_data<mpu4vid_state>();
|
||||
COMBINE_DATA(&state->m_vid_vidram[offset]);
|
||||
COMBINE_DATA(&m_vid_vidram[offset]);
|
||||
offset <<= 1;
|
||||
space.machine().gfx[state->m_gfx_index+0]->mark_dirty(offset/0x20);
|
||||
space.machine().gfx[state->m_gfx_index+1]->mark_dirty(offset/0x20);
|
||||
space.machine().gfx[state->m_gfx_index+2]->mark_dirty(offset/0x20);
|
||||
space.machine().gfx[state->m_gfx_index+3]->mark_dirty(offset/0x20);
|
||||
space.machine().gfx[m_gfx_index+0]->mark_dirty(offset/0x20);
|
||||
space.machine().gfx[m_gfx_index+1]->mark_dirty(offset/0x20);
|
||||
space.machine().gfx[m_gfx_index+2]->mark_dirty(offset/0x20);
|
||||
space.machine().gfx[m_gfx_index+3]->mark_dirty(offset/0x20);
|
||||
}
|
||||
|
||||
|
||||
@ -593,10 +592,9 @@ VIDEO_START_MEMBER(mpu4vid_state,mpu4_vid)
|
||||
|
||||
/* Non-multiplexed mode */
|
||||
|
||||
static WRITE16_HANDLER( ef9369_w )
|
||||
WRITE16_MEMBER(mpu4vid_state::ef9369_w )
|
||||
{
|
||||
mpu4vid_state *state = space.machine().driver_data<mpu4vid_state>();
|
||||
struct ef9369_t &pal = state->m_pal;
|
||||
struct ef9369_t &pal = m_pal;
|
||||
data &= 0x00ff;
|
||||
|
||||
/* Address register */
|
||||
@ -635,10 +633,9 @@ static WRITE16_HANDLER( ef9369_w )
|
||||
}
|
||||
|
||||
|
||||
static READ16_HANDLER( ef9369_r )
|
||||
READ16_MEMBER(mpu4vid_state::ef9369_r )
|
||||
{
|
||||
mpu4vid_state *state = space.machine().driver_data<mpu4vid_state>();
|
||||
struct ef9369_t &pal = state->m_pal;
|
||||
struct ef9369_t &pal = m_pal;
|
||||
if ((offset & 1) == 0)
|
||||
{
|
||||
UINT16 col = pal.clut[pal.addr >> 1];
|
||||
@ -672,10 +669,9 @@ static READ16_HANDLER( ef9369_r )
|
||||
* 1 0 1 Overlay register
|
||||
*/
|
||||
|
||||
WRITE16_HANDLER( bt471_w )
|
||||
WRITE16_MEMBER(mpu4vid_state::bt471_w )
|
||||
{
|
||||
mpu4vid_state *state = space.machine().driver_data<mpu4vid_state>();
|
||||
struct bt471_t &bt471 = state->m_bt471;
|
||||
struct bt471_t &bt471 = m_bt471;
|
||||
UINT8 val = data & 0xff;
|
||||
{
|
||||
popmessage("Bt471: Unhandled write access (offset:%x, data:%x)", offset, val);
|
||||
@ -719,7 +715,7 @@ WRITE16_HANDLER( bt471_w )
|
||||
}
|
||||
}
|
||||
|
||||
READ16_HANDLER( bt471_r )
|
||||
READ16_MEMBER(mpu4vid_state::bt471_r )
|
||||
{
|
||||
popmessage("Bt471: Unhandled read access (offset:%x)", offset);
|
||||
return 0;
|
||||
@ -1412,17 +1408,17 @@ static ADDRESS_MAP_START( mpu4_68k_map, AS_PROGRAM, 16, mpu4vid_state )
|
||||
// AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
|
||||
AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_device, saa1099_data_w, 0x00ff)
|
||||
AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_device, saa1099_control_w, 0x00ff)
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE_LEGACY(ef9369_r, ef9369_w)
|
||||
/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE_LEGACY(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w)
|
||||
/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
|
||||
|
||||
|
||||
AM_RANGE(0xb00000, 0xb0000f) AM_DEVREADWRITE("scn2674_vid", scn2674_device, mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
|
||||
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE_LEGACY(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xff8000, 0xff8001) AM_DEVREADWRITE8("acia6850_1", acia6850_device, status_read, control_write, 0xff)
|
||||
AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8("acia6850_1", acia6850_device, data_read, data_write, 0xff)
|
||||
AM_RANGE(0xff9000, 0xff900f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE_LEGACY(characteriser16_r, characteriser16_w)
|
||||
AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( mpu4oki_68k_map, AS_PROGRAM, 16, mpu4vid_state )
|
||||
@ -1432,18 +1428,18 @@ static ADDRESS_MAP_START( mpu4oki_68k_map, AS_PROGRAM, 16, mpu4vid_state )
|
||||
AM_RANGE(0x800000, 0x80ffff) AM_RAM AM_SHARE("vid_mainram")
|
||||
AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_device, saa1099_data_w, 0x00ff)
|
||||
AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_device, saa1099_control_w, 0x00ff)
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE_LEGACY(ef9369_r, ef9369_w)
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w)
|
||||
|
||||
AM_RANGE(0xb00000, 0xb0000f) AM_DEVREADWRITE("scn2674_vid", scn2674_device, mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
|
||||
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE_LEGACY(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xff8000, 0xff8001) AM_DEVREADWRITE8("acia6850_1", acia6850_device, status_read, control_write, 0xff)
|
||||
AM_RANGE(0xff8002, 0xff8003) AM_DEVREADWRITE8("acia6850_1", acia6850_device, data_read, data_write, 0xff)
|
||||
AM_RANGE(0xff9000, 0xff900f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_device, read, write, 0xff)
|
||||
AM_RANGE(0xffa040, 0xffa04f) AM_DEVREAD8("ptm_ic3ss", ptm6840_device, read,0xff) // 6840PTM on sampled sound board
|
||||
AM_RANGE(0xffa040, 0xffa04f) AM_WRITE8(ic3ss_w,0x00ff) // 6840PTM on sampled sound board
|
||||
AM_RANGE(0xffa060, 0xffa067) AM_DEVREADWRITE8("pia_ic4ss", pia6821_device, read, write,0x00ff) // PIA6821 on sampled sound board
|
||||
AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE_LEGACY(characteriser16_r, characteriser16_w)
|
||||
AM_RANGE(0xffd000, 0xffd00f) AM_READWRITE(characteriser16_r, characteriser16_w)
|
||||
// AM_RANGE(0xfff000, 0xffffff) AM_NOP /* Possible bug, reads and writes here */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -1454,12 +1450,12 @@ static ADDRESS_MAP_START( bwbvid_68k_map, AS_PROGRAM, 16, mpu4vid_state )
|
||||
AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
|
||||
AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_device, saa1099_data_w, 0x00ff)
|
||||
AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_device, saa1099_control_w, 0x00ff)
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE_LEGACY(ef9369_r, ef9369_w)
|
||||
// AM_RANGE(0xa00000, 0xa0000f) AM_READWRITE_LEGACY(bt471_r,bt471_w) //Some games use this
|
||||
/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE_LEGACY(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w)
|
||||
// AM_RANGE(0xa00000, 0xa0000f) AM_READWRITE(bt471_r,bt471_w) //Some games use this
|
||||
/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
|
||||
|
||||
AM_RANGE(0xb00000, 0xb0000f) AM_DEVREADWRITE("scn2674_vid", scn2674_device, mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE_LEGACY(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_device, status_read, control_write, 0xff)
|
||||
AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_device, data_read, data_write, 0xff)
|
||||
AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_device, read, write, 0xff)
|
||||
@ -1472,19 +1468,19 @@ static ADDRESS_MAP_START( bwbvid5_68k_map, AS_PROGRAM, 16, mpu4vid_state )
|
||||
AM_RANGE(0x810000, 0x81ffff) AM_RAM /* ? */
|
||||
AM_RANGE(0x900000, 0x900001) AM_DEVWRITE8("saa", saa1099_device, saa1099_data_w, 0x00ff)
|
||||
AM_RANGE(0x900002, 0x900003) AM_DEVWRITE8("saa", saa1099_device, saa1099_control_w, 0x00ff)
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE_LEGACY(ef9369_r, ef9369_w)
|
||||
//AM_RANGE(0xa00000, 0xa00003) AM_READWRITE_LEGACY(bt471_r,bt471_w) Some games use this
|
||||
/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE_LEGACY(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
|
||||
AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(ef9369_r, ef9369_w)
|
||||
//AM_RANGE(0xa00000, 0xa00003) AM_READWRITE(bt471_r,bt471_w) Some games use this
|
||||
/* AM_RANGE(0xa00004, 0xa0000f) AM_READWRITE(mpu4_vid_unmap_r, mpu4_vid_unmap_w) */
|
||||
|
||||
AM_RANGE(0xb00000, 0xb0000f) AM_DEVREADWRITE("scn2674_vid", scn2674_device, mpu4_vid_scn2674_r, mpu4_vid_scn2674_w)
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE_LEGACY(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xc00000, 0xc1ffff) AM_READWRITE(mpu4_vid_vidram_r, mpu4_vid_vidram_w) AM_SHARE("vid_vidram")
|
||||
AM_RANGE(0xe00000, 0xe00001) AM_DEVREADWRITE8("acia6850_1", acia6850_device, status_read, control_write, 0xff)
|
||||
AM_RANGE(0xe00002, 0xe00003) AM_DEVREADWRITE8("acia6850_1", acia6850_device, data_read, data_write, 0xff)
|
||||
AM_RANGE(0xe01000, 0xe0100f) AM_DEVREADWRITE8("6840ptm_68k", ptm6840_device, read, write, 0x00ff)
|
||||
AM_RANGE(0xe02000, 0xe02007) AM_DEVREADWRITE8("pia_ic4ss", pia6821_device, read, write, 0xff00)
|
||||
AM_RANGE(0xe03000, 0xe0300f) AM_DEVREAD8("ptm_ic3ss", ptm6840_device, read,0xff00) // 6840PTM on sampled sound board
|
||||
AM_RANGE(0xe03000, 0xe0300f) AM_WRITE8(ic3ss_w,0xff00) // 6840PTM on sampled sound board
|
||||
AM_RANGE(0xe04000, 0xe0400f) AM_READWRITE_LEGACY(bwb_characteriser16_r, bwb_characteriser16_w)//AM_READWRITE_LEGACY(adpcm_r, adpcm_w) CHR ?
|
||||
AM_RANGE(0xe04000, 0xe0400f) AM_READWRITE(bwb_characteriser16_r, bwb_characteriser16_w)//AM_READWRITE_LEGACY(adpcm_r, adpcm_w) CHR ?
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -1532,8 +1528,7 @@ static MACHINE_CONFIG_START( mpu4_vid, mpu4vid_state )
|
||||
MCFG_SCREEN_REFRESH_RATE(50)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(mpu4vid_state, screen_update_mpu4_vid)
|
||||
|
||||
MCFG_DEVICE_ADD("scn2674_vid", SCN2674_VIDEO, 0)
|
||||
scn2674_device::set_irq_update_callback(*device, update_mpu68_interrupts);
|
||||
MCFG_SCN2674_VIDEO_ADD("scn2674_vid", 0, WRITELINE(mpu4vid_state, update_mpu68_interrupts));
|
||||
|
||||
MCFG_CPU_ADD("video", M68000, VIDEO_MASTER_CLOCK )
|
||||
MCFG_CPU_PROGRAM_MAP(mpu4_68k_map)
|
||||
@ -1607,31 +1602,30 @@ Characteriser (CHR)
|
||||
the 'challenge' part of the startup check is always the same
|
||||
*/
|
||||
|
||||
static WRITE16_HANDLER( characteriser16_w )
|
||||
WRITE16_MEMBER(mpu4vid_state::characteriser16_w )
|
||||
{
|
||||
mpu4_state *state = space.machine().driver_data<mpu4_state>();
|
||||
int x;
|
||||
int call=data;
|
||||
LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", space.device().safe_pcbase(),offset,data));
|
||||
|
||||
if (!state->m_current_chr_table)
|
||||
if (!m_current_chr_table)
|
||||
{
|
||||
logerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase());
|
||||
return;
|
||||
}
|
||||
|
||||
for (x = state->m_prot_col; x < 64; x++)
|
||||
for (x = m_prot_col; x < 64; x++)
|
||||
{
|
||||
if (call == 0)
|
||||
{
|
||||
state->m_prot_col = 0;
|
||||
m_prot_col = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state->m_current_chr_table[(x)].call == call)
|
||||
if (m_current_chr_table[(x)].call == call)
|
||||
{
|
||||
state->m_prot_col = x;
|
||||
LOG_CHR(("Characteriser find column %02X\n",state->m_prot_col));
|
||||
m_prot_col = x;
|
||||
LOG_CHR(("Characteriser find column %02X\n",m_prot_col));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1639,14 +1633,13 @@ static WRITE16_HANDLER( characteriser16_w )
|
||||
}
|
||||
|
||||
|
||||
static READ16_HANDLER( characteriser16_r )
|
||||
READ16_MEMBER(mpu4vid_state::characteriser16_r )
|
||||
{
|
||||
mpu4_state *state = space.machine().driver_data<mpu4_state>();
|
||||
LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", space.device().safe_pcbase(),offset,state->m_current_chr_table[state->m_prot_col].response));
|
||||
LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", space.device().safe_pcbase(),offset,m_current_chr_table[m_prot_col].response));
|
||||
LOG_CHR(("Characteriser read offset %02X \n",offset));
|
||||
LOG_CHR(("Characteriser read data %02X \n",state->m_current_chr_table[state->m_prot_col].response));
|
||||
LOG_CHR(("Characteriser read data %02X \n",m_current_chr_table[m_prot_col].response));
|
||||
|
||||
if (!state->m_current_chr_table)
|
||||
if (!m_current_chr_table)
|
||||
{
|
||||
logerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase());
|
||||
return 0x00;
|
||||
@ -1659,7 +1652,7 @@ static READ16_HANDLER( characteriser16_r )
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
return state->m_current_chr_table[state->m_prot_col].response;
|
||||
return m_current_chr_table[m_prot_col].response;
|
||||
}
|
||||
|
||||
|
||||
@ -1679,13 +1672,12 @@ Precedent suggests this is not that dangerous an assumption to make.
|
||||
*/
|
||||
|
||||
|
||||
static WRITE16_HANDLER( bwb_characteriser16_w )
|
||||
WRITE16_MEMBER(mpu4vid_state::bwb_characteriser16_w )
|
||||
{
|
||||
mpu4_state *state = space.machine().driver_data<mpu4_state>();
|
||||
int x;
|
||||
int call=data &0xff;
|
||||
LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X \n", space.device().safe_pcbase(),offset,data));
|
||||
if (!state->m_current_chr_table)
|
||||
if (!m_current_chr_table)
|
||||
{
|
||||
logerror("No Characteriser Table @ %04x\n", space.device().safe_pcbase());
|
||||
return;
|
||||
@ -1693,46 +1685,44 @@ static WRITE16_HANDLER( bwb_characteriser16_w )
|
||||
|
||||
if (offset == 0)
|
||||
{
|
||||
if (!state->m_chr_state)
|
||||
if (!m_chr_state)
|
||||
{
|
||||
state->m_chr_state=1;
|
||||
state->m_chr_counter=0;
|
||||
m_chr_state=1;
|
||||
m_chr_counter=0;
|
||||
}
|
||||
if (call == 0)
|
||||
{
|
||||
state->m_init_col ++;
|
||||
m_init_col ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_init_col =0;
|
||||
m_init_col =0;
|
||||
}
|
||||
}
|
||||
state->m_chr_value = space.machine().rand();
|
||||
m_chr_value = space.machine().rand();
|
||||
for (x = 0; x < 4; x++)
|
||||
{
|
||||
if (state->m_current_chr_table[(x)].call == call)
|
||||
if (m_current_chr_table[(x)].call == call)
|
||||
{
|
||||
if (x == 0) // reinit
|
||||
{
|
||||
state->m_bwb_return = 0;
|
||||
m_bwb_return = 0;
|
||||
}
|
||||
state->m_chr_value = bwb_chr_table_common[(state->m_bwb_return)];
|
||||
state->m_bwb_return++;
|
||||
m_chr_value = bwb_chr_table_common[(m_bwb_return)];
|
||||
m_bwb_return++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static READ16_HANDLER( bwb_characteriser16_r )
|
||||
READ16_MEMBER(mpu4vid_state::bwb_characteriser16_r )
|
||||
{
|
||||
mpu4_state *state = space.machine().driver_data<mpu4_state>();
|
||||
|
||||
LOG_CHR(("Characteriser read offset %02X \n",offset));
|
||||
|
||||
|
||||
if (offset ==0)
|
||||
{
|
||||
switch (state->m_chr_counter)
|
||||
switch (m_chr_counter)
|
||||
{
|
||||
case 6:
|
||||
case 13:
|
||||
@ -1740,23 +1730,23 @@ static READ16_HANDLER( bwb_characteriser16_r )
|
||||
case 27:
|
||||
case 34:
|
||||
{
|
||||
return state->m_bwb_chr_table1[(((state->m_chr_counter + 1) / 7) - 1)].response;
|
||||
return m_bwb_chr_table1[(((m_chr_counter + 1) / 7) - 1)].response;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (state->m_chr_counter > 34)
|
||||
if (m_chr_counter > 34)
|
||||
{
|
||||
state->m_chr_counter = 35;
|
||||
state->m_chr_state = 2;
|
||||
m_chr_counter = 35;
|
||||
m_chr_state = 2;
|
||||
}
|
||||
state->m_chr_counter ++;
|
||||
return state->m_chr_value;
|
||||
m_chr_counter ++;
|
||||
return m_chr_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return state->m_chr_value;
|
||||
return m_chr_value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,16 +33,10 @@
|
||||
const device_type SCN2674_VIDEO = &device_creator<scn2674_device>;
|
||||
|
||||
|
||||
static void default_scn2674_callback(running_machine &machine)
|
||||
{
|
||||
// logerror("no scn2674_callback\n");
|
||||
}
|
||||
|
||||
|
||||
scn2674_device::scn2674_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, SCN2674_VIDEO, "scn2674_device", tag, owner, clock)
|
||||
: device_t(mconfig, SCN2674_VIDEO, "scn2674_device", tag, owner, clock),
|
||||
m_interrupt_callback(*this)
|
||||
{
|
||||
m_interrupt_callback = default_scn2674_callback;
|
||||
}
|
||||
|
||||
|
||||
@ -50,6 +44,8 @@ scn2674_device::scn2674_device(const machine_config &mconfig, const char *tag, d
|
||||
|
||||
void scn2674_device::device_start()
|
||||
{
|
||||
// resolve callbacks
|
||||
m_interrupt_callback.resolve_safe();
|
||||
}
|
||||
|
||||
void scn2674_device::device_reset()
|
||||
@ -112,13 +108,6 @@ void scn2674_device::device_reset()
|
||||
m_scn2674_irq_state= 0;
|
||||
}
|
||||
|
||||
|
||||
void scn2674_device::set_irq_update_callback(device_t &device, s2574_interrupt_callback_func callback)
|
||||
{
|
||||
scn2674_device &dev = downcast<scn2674_device &>(device);
|
||||
dev.m_interrupt_callback = callback;
|
||||
}
|
||||
|
||||
// 15 Initialization Registers (8-bit each)
|
||||
void scn2674_device::scn2674_write_init_regs(UINT8 data)
|
||||
{
|
||||
@ -397,7 +386,7 @@ void scn2674_device::scn2674_write_command(running_machine &machine, UINT8 data)
|
||||
m_scn2674_irq_state = 1;
|
||||
}
|
||||
}
|
||||
m_interrupt_callback(machine);
|
||||
m_interrupt_callback(1);
|
||||
|
||||
}
|
||||
if ((data&0xe0)==0x80)
|
||||
@ -599,7 +588,7 @@ void scn2674_device::scn2674_line(running_machine &machine)
|
||||
LOG2674(("SCN2674 Ready\n"));
|
||||
m_scn2674_irq_state = 1;
|
||||
m_scn2674_irq_register |= 0x02;
|
||||
m_interrupt_callback(machine);
|
||||
m_interrupt_callback(1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +601,7 @@ void scn2674_device::scn2674_line(running_machine &machine)
|
||||
LOG2674(("SCN2674 Line Zero\n"));
|
||||
m_scn2674_irq_state = 1;
|
||||
m_scn2674_irq_register |= 0x08;
|
||||
m_interrupt_callback(machine);
|
||||
m_interrupt_callback(1);
|
||||
}
|
||||
m_rowcounter = ((m_rowcounter+1)% 37);//Not currently used
|
||||
}
|
||||
@ -632,7 +621,7 @@ void scn2674_device::scn2674_line(running_machine &machine)
|
||||
m_scn2674_irq_register |= 0x04;
|
||||
LOG2674(("SCN2674 Split Screen 1\n"));
|
||||
m_scn2674_irq_state = 1;
|
||||
m_interrupt_callback(machine);
|
||||
m_interrupt_callback(1);
|
||||
// machine.primary_screen->update_partial(m_linecounter);
|
||||
}
|
||||
}
|
||||
@ -652,7 +641,7 @@ void scn2674_device::scn2674_line(running_machine &machine)
|
||||
LOG2674(("SCN2674 Split Screen 2 irq\n"));
|
||||
m_scn2674_irq_state = 1;
|
||||
m_scn2674_irq_register |= 0x01;
|
||||
m_interrupt_callback(machine);
|
||||
m_interrupt_callback(1);
|
||||
//machine.primary_screen->update_partial(m_linecounter);
|
||||
}
|
||||
}
|
||||
@ -665,7 +654,7 @@ void scn2674_device::scn2674_line(running_machine &machine)
|
||||
LOG2674(("vblank irq\n"));
|
||||
m_scn2674_irq_state = 1;
|
||||
m_scn2674_irq_register |= 0x10;
|
||||
m_interrupt_callback(machine);
|
||||
m_interrupt_callback(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,11 @@
|
||||
#define S674VERBOSE 0
|
||||
#define LOG2674(x) do { if (S674VERBOSE) logerror x; } while (0)
|
||||
|
||||
|
||||
#define MCFG_SCN2674_VIDEO_ADD(_tag, _clock, _irq) \
|
||||
MCFG_DEVICE_ADD(_tag, SCN2674_VIDEO, _clock) \
|
||||
downcast<scn2674_device *>(device)->set_callbacks(DEVCB2_##_irq);
|
||||
|
||||
typedef void (*s2574_interrupt_callback_func)(running_machine &machine);
|
||||
|
||||
static const UINT8 vsync_table[4] = {3,1,5,7}; //Video related
|
||||
@ -11,9 +16,9 @@ class scn2674_device : public device_t
|
||||
public:
|
||||
scn2674_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void set_irq_update_callback(device_t &device, s2574_interrupt_callback_func callback);
|
||||
|
||||
|
||||
template<class _irq> void set_callbacks(_irq irq) {
|
||||
m_interrupt_callback.set_callback(irq);
|
||||
}
|
||||
// int m_gfx_index;
|
||||
|
||||
DECLARE_READ16_MEMBER( mpu4_vid_scn2674_r );
|
||||
@ -36,7 +41,7 @@ protected:
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
s2574_interrupt_callback_func m_interrupt_callback;
|
||||
devcb2_write_line m_interrupt_callback;
|
||||
|
||||
UINT8 m_scn2674_IR_pointer;
|
||||
UINT8 m_scn2674_screen1_l;
|
||||
|
Loading…
Reference in New Issue
Block a user