mirror of
https://github.com/holub/mame
synced 2025-05-28 16:43:04 +03:00
huc6270_device: converted to devcb2 (nw)
This commit is contained in:
parent
6f17d6cfc7
commit
98fcb2739d
@ -94,24 +94,10 @@ const device_type HUC6270 = &device_creator<huc6270_device>;
|
||||
|
||||
const UINT8 huc6270_device::vram_increments[4] = { 1, 32, 64, 128 };
|
||||
|
||||
|
||||
void huc6270_device::device_config_complete()
|
||||
{
|
||||
const huc6270_interface *intf = reinterpret_cast<const huc6270_interface *>(static_config());
|
||||
|
||||
if ( intf != NULL )
|
||||
{
|
||||
*static_cast<huc6270_interface *>(this) = *intf;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&m_irq_changed, 0, sizeof(m_irq_changed));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
huc6270_device::huc6270_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, HUC6270, "HuC6270 VDC", tag, owner, clock, "huc6270", __FILE__)
|
||||
: device_t(mconfig, HUC6270, "HuC6270 VDC", tag, owner, clock, "huc6270", __FILE__),
|
||||
m_vram_size(0),
|
||||
m_irq_changed_cb(*this)
|
||||
{
|
||||
}
|
||||
|
||||
@ -293,7 +279,7 @@ void huc6270_device::select_sprites()
|
||||
if ( m_cr & 0x02 )
|
||||
{
|
||||
m_status |= HUC6270_OR;
|
||||
m_irq_changed( ASSERT_LINE );
|
||||
m_irq_changed_cb( ASSERT_LINE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -306,7 +292,7 @@ inline void huc6270_device::handle_vblank()
|
||||
if ( m_cr & 0x08 )
|
||||
{
|
||||
m_status |= HUC6270_VD;
|
||||
m_irq_changed( ASSERT_LINE );
|
||||
m_irq_changed_cb( ASSERT_LINE );
|
||||
}
|
||||
|
||||
/* Should we initiate a VRAM->SATB DMA transfer.
|
||||
@ -331,7 +317,7 @@ inline void huc6270_device::handle_vblank()
|
||||
{
|
||||
m_satb_countdown = 4;
|
||||
// m_status |= HUC6270_DS;
|
||||
// m_irq_changed( ASSERT_LINE );
|
||||
// m_irq_changed_cb( ASSERT_LINE );
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,7 +457,7 @@ READ16_MEMBER( huc6270_device::next_pixel )
|
||||
if ( collission && ( m_cr & 0x01 ) )
|
||||
{
|
||||
m_status |= HUC6270_CR;
|
||||
m_irq_changed( ASSERT_LINE );
|
||||
m_irq_changed_cb( ASSERT_LINE );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -533,7 +519,7 @@ WRITE_LINE_MEMBER( huc6270_device::vsync_changed )
|
||||
if ( m_dcr & 0x0002 )
|
||||
{
|
||||
m_status |= HUC6270_DV;
|
||||
m_irq_changed( ASSERT_LINE );
|
||||
m_irq_changed_cb( ASSERT_LINE );
|
||||
}
|
||||
m_dma_enabled = 0;
|
||||
}
|
||||
@ -559,7 +545,7 @@ WRITE_LINE_MEMBER( huc6270_device::hsync_changed )
|
||||
if ( m_satb_countdown == 0 )
|
||||
{
|
||||
m_status |= HUC6270_DS;
|
||||
m_irq_changed( ASSERT_LINE );
|
||||
m_irq_changed_cb( ASSERT_LINE );
|
||||
}
|
||||
}
|
||||
|
||||
@ -581,7 +567,7 @@ WRITE_LINE_MEMBER( huc6270_device::hsync_changed )
|
||||
if ( m_raster_count == m_rcr && ( m_cr & 0x04 ) )
|
||||
{
|
||||
m_status |= HUC6270_RR;
|
||||
m_irq_changed( ASSERT_LINE );
|
||||
m_irq_changed_cb( ASSERT_LINE );
|
||||
}
|
||||
}
|
||||
|
||||
@ -598,7 +584,7 @@ READ8_MEMBER( huc6270_device::read )
|
||||
case 0x00: /* status */
|
||||
data = m_status;
|
||||
m_status &= ~( HUC6270_VD | HUC6270_DV | HUC6270_RR | HUC6270_CR | HUC6270_OR | HUC6270_DS );
|
||||
m_irq_changed( CLEAR_LINE );
|
||||
m_irq_changed_cb( CLEAR_LINE );
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
@ -654,7 +640,7 @@ WRITE8_MEMBER( huc6270_device::write )
|
||||
// if ( m_raster_count == m_rcr && m_cr & 0x04 )
|
||||
// {
|
||||
// m_status |= HUC6270_RR;
|
||||
// m_irq_changed( ASSERT_LINE );
|
||||
// m_irq_changed_cb( ASSERT_LINE );
|
||||
// }
|
||||
//if (LOG) printf("%04x: RCR (%03x) written at %d,%d\n", activecpu_get_pc(), huc6270->m_rcr, video_screen_get_vpos(device->machine->first_screen()), video_screen_get_hpos(device->machine->first_screen()) );
|
||||
break;
|
||||
@ -745,7 +731,7 @@ WRITE8_MEMBER( huc6270_device::write )
|
||||
// if ( m_raster_count == m_rcr && m_cr & 0x04 )
|
||||
// {
|
||||
// m_status |= HUC6270_RR;
|
||||
// m_irq_changed( ASSERT_LINE );
|
||||
// m_irq_changed_cb( ASSERT_LINE );
|
||||
// }
|
||||
break;
|
||||
|
||||
@ -814,14 +800,12 @@ WRITE8_MEMBER( huc6270_device::write )
|
||||
void huc6270_device::device_start()
|
||||
{
|
||||
/* Resolve callbacks */
|
||||
m_irq_changed.resolve( irq_changed, *this );
|
||||
m_irq_changed_cb.resolve_safe();
|
||||
|
||||
assert( ! m_irq_changed.isnull() );
|
||||
m_vram = auto_alloc_array_clear(machine(), UINT16, m_vram_size/sizeof(UINT16));
|
||||
m_vram_mask = (m_vram_size >> 1) - 1;
|
||||
|
||||
m_vram = auto_alloc_array_clear(machine(), UINT16, vram_size/sizeof(UINT16));
|
||||
m_vram_mask = (vram_size >> 1) - 1;
|
||||
|
||||
save_pointer(NAME(m_vram), vram_size/sizeof(UINT16));
|
||||
save_pointer(NAME(m_vram), m_vram_size/sizeof(UINT16));
|
||||
|
||||
save_item(NAME(m_register_index));
|
||||
save_item(NAME(m_mawr));
|
||||
|
@ -9,28 +9,20 @@
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
#define MCFG_HUC6270_VRAM_SIZE(_size) \
|
||||
huc6270_device::set_vram_size(*device, _size);
|
||||
|
||||
#define MCFG_HUC6270_IRQ_CHANGED_CB(_devcb) \
|
||||
devcb = &huc6270_device::set_irq_changed_callback(*device, DEVCB2_##_devcb);
|
||||
|
||||
#define MCFG_HUC6270_ADD( _tag, _intrf ) \
|
||||
MCFG_DEVICE_ADD( _tag, HUC6270, 0 ) \
|
||||
MCFG_DEVICE_CONFIG( _intrf )
|
||||
|
||||
|
||||
struct huc6270_interface
|
||||
{
|
||||
/* Size of Video ram (mandatory) */
|
||||
UINT32 vram_size;
|
||||
/* Callback for when the irq line may have changed (mandatory) */
|
||||
devcb_write_line irq_changed;
|
||||
};
|
||||
|
||||
|
||||
class huc6270_device : public device_t,
|
||||
public huc6270_interface
|
||||
class huc6270_device : public device_t
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
huc6270_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void set_vram_size(device_t &device, UINT32 vram_size) { downcast<huc6270_device &>(device).m_vram_size = vram_size; }
|
||||
template<class _Object> static devcb2_base &set_irq_changed_callback(device_t &device, _Object object) { return downcast<huc6270_device &>(device).m_irq_changed_cb.set_callback(object); }
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
@ -48,7 +40,6 @@ public:
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
|
||||
@ -75,8 +66,12 @@ private:
|
||||
HUC6270_HSW
|
||||
};
|
||||
|
||||
/* Callbacks */
|
||||
devcb_resolved_write_line m_irq_changed;
|
||||
|
||||
/* Size of Video ram (mandatory) */
|
||||
UINT32 m_vram_size;
|
||||
|
||||
/* Callback for when the irq line may have changed (mandatory) */
|
||||
devcb2_write_line m_irq_changed_cb;
|
||||
|
||||
UINT8 m_register_index;
|
||||
|
||||
|
@ -180,20 +180,6 @@ static const c6280_interface c6280_config =
|
||||
"maincpu"
|
||||
};
|
||||
|
||||
static const huc6270_interface sgx_huc6270_0_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pce_common_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6270_interface sgx_huc6270_1_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pce_common_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6202_interface sgx_huc6202_config =
|
||||
{
|
||||
DEVCB_DEVICE_MEMBER16( "huc6270_0", huc6270_device, next_pixel ),
|
||||
@ -232,8 +218,12 @@ static MACHINE_CONFIG_START( ggconnie, ggconnie_state )
|
||||
MCFG_SCREEN_PALETTE("huc6260:palette")
|
||||
|
||||
MCFG_HUC6260_ADD( "huc6260", PCE_MAIN_CLOCK/3, sgx_huc6260_config )
|
||||
MCFG_HUC6270_ADD( "huc6270_0", sgx_huc6270_0_config )
|
||||
MCFG_HUC6270_ADD( "huc6270_1", sgx_huc6270_1_config )
|
||||
MCFG_DEVICE_ADD( "huc6270_0", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_common_state, pce_irq_changed))
|
||||
MCFG_DEVICE_ADD( "huc6270_1", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_common_state, pce_irq_changed))
|
||||
MCFG_HUC6202_ADD( "huc6202", sgx_huc6202_config )
|
||||
|
||||
MCFG_DEVICE_ADD("rtc", MSM6242, XTAL_32_768kHz)
|
||||
|
@ -174,14 +174,6 @@ static const c6280_interface c6280_config =
|
||||
"maincpu"
|
||||
};
|
||||
|
||||
|
||||
static const huc6270_interface pce_huc6270_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pce_common_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6260_interface pce_huc6260_config =
|
||||
{
|
||||
DEVCB_DEVICE_MEMBER16( "huc6270", huc6270_device, next_pixel ),
|
||||
@ -214,7 +206,9 @@ static MACHINE_CONFIG_START( paranoia, paranoia_state )
|
||||
MCFG_SCREEN_PALETTE("huc6260:palette")
|
||||
|
||||
MCFG_HUC6260_ADD( "huc6260", PCE_MAIN_CLOCK, pce_huc6260_config )
|
||||
MCFG_HUC6270_ADD( "huc6270", pce_huc6270_config )
|
||||
MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_common_state, pce_irq_changed))
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
|
||||
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
|
||||
|
@ -369,13 +369,6 @@ WRITE_LINE_MEMBER(tourvision_state::pce_irq_changed)
|
||||
}
|
||||
|
||||
|
||||
static const huc6270_interface pce_huc6270_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(tourvision_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6260_interface pce_huc6260_config =
|
||||
{
|
||||
DEVCB_DEVICE_MEMBER16( "huc6270", huc6270_device, next_pixel ),
|
||||
@ -401,7 +394,9 @@ static MACHINE_CONFIG_START( tourvision, tourvision_state )
|
||||
MCFG_SCREEN_PALETTE("huc6260:palette")
|
||||
|
||||
MCFG_HUC6260_ADD( "huc6260", PCE_MAIN_CLOCK, pce_huc6260_config )
|
||||
MCFG_HUC6270_ADD( "huc6270", pce_huc6270_config )
|
||||
MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(tourvision_state, pce_irq_changed))
|
||||
|
||||
|
||||
MCFG_I8155_ADD("i8155", 1000000 /*?*/, i8155_intf)
|
||||
|
@ -311,13 +311,6 @@ WRITE_LINE_MEMBER(uapce_state::pce_irq_changed)
|
||||
}
|
||||
|
||||
|
||||
static const huc6270_interface pce_huc6270_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(uapce_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6260_interface pce_huc6260_config =
|
||||
{
|
||||
DEVCB_DEVICE_MEMBER16( "huc6270", huc6270_device, next_pixel ),
|
||||
@ -343,7 +336,9 @@ static MACHINE_CONFIG_START( uapce, uapce_state )
|
||||
MCFG_SCREEN_PALETTE("huc6260:palette")
|
||||
|
||||
MCFG_HUC6260_ADD( "huc6260", PCE_MAIN_CLOCK, pce_huc6260_config )
|
||||
MCFG_HUC6270_ADD( "huc6270", pce_huc6270_config )
|
||||
MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(uapce_state, pce_irq_changed))
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker")
|
||||
MCFG_SOUND_ADD("c6280", C6280, PCE_MAIN_CLOCK/6)
|
||||
|
@ -302,13 +302,6 @@ WRITE_LINE_MEMBER(pce_state::pce_irq_changed)
|
||||
}
|
||||
|
||||
|
||||
static const huc6270_interface pce_huc6270_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pce_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6260_interface pce_huc6260_config =
|
||||
{
|
||||
DEVCB_DEVICE_MEMBER16( "huc6270", huc6270_device, next_pixel ),
|
||||
@ -318,20 +311,6 @@ static const huc6260_interface pce_huc6260_config =
|
||||
};
|
||||
|
||||
|
||||
static const huc6270_interface sgx_huc6270_0_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pce_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6270_interface sgx_huc6270_1_config =
|
||||
{
|
||||
0x10000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pce_state,pce_irq_changed)
|
||||
};
|
||||
|
||||
|
||||
static const huc6202_interface sgx_huc6202_config =
|
||||
{
|
||||
DEVCB_DEVICE_MEMBER16( "huc6270_0", huc6270_device, next_pixel ),
|
||||
@ -383,7 +362,9 @@ static MACHINE_CONFIG_START( pce_common, pce_state )
|
||||
MCFG_SCREEN_PALETTE("huc6260:palette")
|
||||
|
||||
MCFG_HUC6260_ADD( "huc6260", MAIN_CLOCK, pce_huc6260_config )
|
||||
MCFG_HUC6270_ADD( "huc6270", pce_huc6270_config )
|
||||
MCFG_DEVICE_ADD( "huc6270", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed))
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
MCFG_SOUND_ADD(C6280_TAG, C6280, MAIN_CLOCK/6)
|
||||
@ -426,8 +407,12 @@ static MACHINE_CONFIG_START( sgx, pce_state )
|
||||
MCFG_SCREEN_PALETTE("huc6260:palette")
|
||||
|
||||
MCFG_HUC6260_ADD( "huc6260", MAIN_CLOCK, sgx_huc6260_config )
|
||||
MCFG_HUC6270_ADD( "huc6270_0", sgx_huc6270_0_config )
|
||||
MCFG_HUC6270_ADD( "huc6270_1", sgx_huc6270_1_config )
|
||||
MCFG_DEVICE_ADD( "huc6270_0", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed))
|
||||
MCFG_DEVICE_ADD( "huc6270_1", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x10000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pce_state, pce_irq_changed))
|
||||
MCFG_HUC6202_ADD( "huc6202", sgx_huc6202_config )
|
||||
|
||||
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
|
||||
|
@ -464,20 +464,6 @@ static const huc6261_interface pcfx_huc6261_config =
|
||||
};
|
||||
|
||||
|
||||
static const huc6270_interface pcfx_huc6270_a_config =
|
||||
{
|
||||
0x20000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pcfx_state, irq12_w)
|
||||
};
|
||||
|
||||
|
||||
static const huc6270_interface pcfx_huc6270_b_config =
|
||||
{
|
||||
0x20000,
|
||||
DEVCB_DRIVER_LINE_MEMBER(pcfx_state, irq14_w)
|
||||
};
|
||||
|
||||
|
||||
void pcfx_state::machine_reset()
|
||||
{
|
||||
membank( "bank1" )->set_base( memregion("user1")->base() );
|
||||
@ -503,8 +489,12 @@ static MACHINE_CONFIG_START( pcfx, pcfx_state )
|
||||
MCFG_SCREEN_UPDATE_DRIVER(pcfx_state, screen_update)
|
||||
MCFG_SCREEN_RAW_PARAMS(XTAL_21_4772MHz, HUC6261_WPF, 64, 64 + 1024 + 64, HUC6261_LPF, 18, 18 + 242)
|
||||
|
||||
MCFG_HUC6270_ADD( "huc6270_a", pcfx_huc6270_a_config )
|
||||
MCFG_HUC6270_ADD( "huc6270_b", pcfx_huc6270_b_config )
|
||||
MCFG_DEVICE_ADD( "huc6270_a", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x20000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq12_w))
|
||||
MCFG_DEVICE_ADD( "huc6270_b", HUC6270, 0 )
|
||||
MCFG_HUC6270_VRAM_SIZE(0x20000)
|
||||
MCFG_HUC6270_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq14_w))
|
||||
MCFG_HUC6261_ADD( "huc6261", XTAL_21_4772MHz, pcfx_huc6261_config )
|
||||
MCFG_HUC6272_ADD( "huc6272", XTAL_21_4772MHz )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user