mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
Device hookups (nw)
This commit is contained in:
parent
1504931203
commit
7153b2a49e
@ -27,7 +27,10 @@ const device_type HUC6261 = &device_creator<huc6261_device>;
|
||||
|
||||
huc6261_device::huc6261_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, HUC6261, "HuC6261", tag, owner, clock, "huc6261", __FILE__),
|
||||
device_video_interface(mconfig, *this), m_huc6270_a_tag(nullptr), m_huc6270_b_tag(nullptr), m_huc6270_a(nullptr), m_huc6270_b(nullptr), m_last_h(0), m_last_v(0), m_height(0), m_address(0), m_palette_latch(0), m_register(0), m_control(0), m_pixels_per_clock(0), m_pixel_data_a(0), m_pixel_data_b(0), m_pixel_clock(0), m_timer(nullptr), m_bmp(nullptr)
|
||||
device_video_interface(mconfig, *this),
|
||||
m_huc6270_a_tag(nullptr), m_huc6270_b_tag(nullptr), m_huc6272_tag(nullptr),
|
||||
m_huc6270_a(nullptr), m_huc6270_b(nullptr), m_huc6272(nullptr),
|
||||
m_last_h(0), m_last_v(0), m_height(0), m_address(0), m_palette_latch(0), m_register(0), m_control(0), m_pixels_per_clock(0), m_pixel_data_a(0), m_pixel_data_b(0), m_pixel_clock(0), m_timer(nullptr), m_bmp(nullptr)
|
||||
{
|
||||
// Set up UV lookup table
|
||||
for ( int ur = 0; ur < 256; ur++ )
|
||||
@ -106,10 +109,10 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
g_profiler.stop();
|
||||
}
|
||||
|
||||
bitmap_line[ h ] = yuv2rgb( m_palette[m_pixel_data_a] );
|
||||
bitmap_line[ h ] = yuv2rgb( m_palette[ m_pixel_data_a ] );
|
||||
// TODO: is mixing correct?
|
||||
if((m_pixel_data_b & 0xff) != 0)
|
||||
bitmap_line[ h ] = yuv2rgb( m_palette[m_pixel_data_b] );
|
||||
bitmap_line[ h ] = yuv2rgb( m_palette[ m_pixel_data_b ] );
|
||||
|
||||
m_pixel_clock = ( m_pixel_clock + 1 ) % m_pixels_per_clock;
|
||||
h = ( h + 1 ) % HUC6261_WPF;
|
||||
@ -407,16 +410,19 @@ void huc6261_device::device_start()
|
||||
/* Make sure we are supplied all our mandatory tags */
|
||||
assert( m_huc6270_a_tag != nullptr );
|
||||
assert( m_huc6270_b_tag != nullptr );
|
||||
assert( m_huc6272_tag != nullptr );
|
||||
|
||||
m_timer = timer_alloc();
|
||||
m_huc6270_a = machine().device<huc6270_device>(m_huc6270_a_tag);
|
||||
m_huc6270_b = machine().device<huc6270_device>(m_huc6270_b_tag);
|
||||
m_huc6272 = machine().device<huc6272_device>(m_huc6272_tag);
|
||||
|
||||
m_bmp = std::make_unique<bitmap_rgb32>(HUC6261_WPF, HUC6261_LPF );
|
||||
|
||||
/* We want to have valid devices */
|
||||
assert( m_huc6270_a != nullptr );
|
||||
assert( m_huc6270_b != nullptr );
|
||||
assert( m_huc6272 != nullptr );
|
||||
|
||||
save_item(NAME(m_last_h));
|
||||
save_item(NAME(m_last_v));
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "video/huc6270.h"
|
||||
|
||||
#include "video/huc6272.h"
|
||||
|
||||
/* Screen timing stuff */
|
||||
#define HUC6261_WPF 1365 /* width of a line in frame including blanking areas */
|
||||
@ -25,6 +25,9 @@
|
||||
#define MCFG_HUC6261_VDC2(_tag) \
|
||||
huc6261_device::set_vdc2_tag(*device, _tag);
|
||||
|
||||
#define MCFG_HUC6261_KING(_tag) \
|
||||
huc6261_device::set_king_tag(*device, _tag);
|
||||
|
||||
|
||||
class huc6261_device : public device_t,
|
||||
public device_video_interface
|
||||
@ -35,6 +38,7 @@ public:
|
||||
|
||||
static void set_vdc1_tag(device_t &device, const char *tag) { downcast<huc6261_device &>(device).m_huc6270_a_tag = tag; }
|
||||
static void set_vdc2_tag(device_t &device, const char *tag) { downcast<huc6261_device &>(device).m_huc6270_b_tag = tag; }
|
||||
static void set_king_tag(device_t &device, const char *tag) { downcast<huc6261_device &>(device).m_huc6272_tag = tag; }
|
||||
|
||||
void video_update(bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_READ16_MEMBER( read );
|
||||
@ -49,9 +53,11 @@ protected:
|
||||
private:
|
||||
const char *m_huc6270_a_tag;
|
||||
const char *m_huc6270_b_tag;
|
||||
const char *m_huc6272_tag;
|
||||
|
||||
huc6270_device *m_huc6270_a;
|
||||
huc6270_device *m_huc6270_b;
|
||||
huc6272_device *m_huc6272;
|
||||
int m_last_h;
|
||||
int m_last_v;
|
||||
int m_height;
|
||||
|
@ -27,11 +27,19 @@ const device_type huc6271 = &device_creator<huc6271_device>;
|
||||
// huc6271_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
static ADDRESS_MAP_START( data_map, AS_DATA, 32, huc6271_device )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
huc6271_device::huc6271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, huc6271, "HuC6271 \"Rainbow\"", tag, owner, clock, "huc6271", __FILE__)
|
||||
: device_t(mconfig, huc6271, "HuC6271 \"Rainbow\"", tag, owner, clock, "huc6271", __FILE__),
|
||||
device_memory_interface(mconfig, *this),
|
||||
m_data_space_config("data", ENDIANNESS_LITTLE, 32, 32, 0, nullptr, *ADDRESS_MAP_NAME(data_map))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
DEVICE_ADDRESS_MAP_START( regs, 16, huc6271_device )
|
||||
AM_RANGE(0x00, 0x01) AM_WRITENOP // hscroll
|
||||
AM_RANGE(0x02, 0x03) AM_WRITENOP // control
|
||||
@ -58,8 +66,23 @@ void huc6271_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
const address_space_config *huc6271_device::memory_space_config(address_spacenum spacenum) const
|
||||
{
|
||||
switch(spacenum)
|
||||
{
|
||||
// case AS_PROGRAM: return &m_program_space_config;
|
||||
case AS_DATA: return &m_data_space_config;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// READ/WRITE HANDLERS
|
||||
//**************************************************************************
|
||||
|
||||
#if 0
|
||||
void huc6271_device::data_transfer(uint32_t offset, uint32_t data)
|
||||
{
|
||||
space(AS_DATA).write_dword(offset,data);
|
||||
}
|
||||
#endif
|
||||
|
@ -26,7 +26,8 @@
|
||||
|
||||
// ======================> huc6271_device
|
||||
|
||||
class huc6271_device : public device_t
|
||||
class huc6271_device : public device_t,
|
||||
public device_memory_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
@ -34,12 +35,17 @@ public:
|
||||
|
||||
// I/O operations
|
||||
DECLARE_ADDRESS_MAP(regs, 16);
|
||||
//void data_transfer(uint32_t offset, uint32_t data);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
// virtual void device_validity_check(validity_checker &valid) const;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_DATA) const override;
|
||||
|
||||
private:
|
||||
const address_space_config m_data_space_config;
|
||||
};
|
||||
|
||||
|
||||
|
@ -72,6 +72,10 @@ void huc6272_device::device_start()
|
||||
{
|
||||
m_irq_changed_cb.resolve_safe();
|
||||
|
||||
assert( m_huc6271_tag != nullptr );
|
||||
|
||||
m_huc6271 = machine().device<huc6271_device>(m_huc6271_tag);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -212,6 +216,7 @@ WRITE32_MEMBER( huc6272_device::write )
|
||||
m_scsibus->write_sel(BIT(data, 2));
|
||||
m_scsibus->write_ack(BIT(data, 4));
|
||||
m_scsibus->write_rst(BIT(data, 7));
|
||||
|
||||
break;
|
||||
|
||||
case 0x02: // SCSI mode
|
||||
@ -365,6 +370,7 @@ WRITE32_MEMBER( huc6272_device::write )
|
||||
m_bg[reg_offs].xscroll = data & 0xffff;
|
||||
break;
|
||||
}
|
||||
|
||||
//default: printf("%04x %04x %08x\n",m_register,data,mem_mask);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "bus/scsi/scsi.h"
|
||||
#include "bus/scsi/scsicd.h"
|
||||
#include "video/huc6271.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -25,6 +26,9 @@
|
||||
#define MCFG_HUC6272_IRQ_CHANGED_CB(_devcb) \
|
||||
devcb = &huc6272_device::set_irq_changed_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_HUC6272_RAINBOW(_tag) \
|
||||
huc6272_device::set_rainbow_tag(*device, _tag);
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
@ -40,6 +44,7 @@ public:
|
||||
huc6272_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
template<class _Object> static devcb_base &set_irq_changed_callback(device_t &device, _Object object) { return downcast<huc6272_device &>(device).m_irq_changed_cb.set_callback(object); }
|
||||
static void set_rainbow_tag(device_t &device, const char *tag) { downcast<huc6272_device &>(device).m_huc6271_tag = tag; }
|
||||
|
||||
// I/O operations
|
||||
DECLARE_WRITE32_MEMBER( write );
|
||||
@ -54,6 +59,10 @@ protected:
|
||||
virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_PROGRAM) const override;
|
||||
|
||||
private:
|
||||
const char *m_huc6271_tag;
|
||||
|
||||
huc6271_device *m_huc6271;
|
||||
|
||||
uint8_t m_register;
|
||||
uint32_t m_kram_addr_r, m_kram_addr_w;
|
||||
uint16_t m_kram_inc_r,m_kram_inc_w;
|
||||
@ -78,12 +87,11 @@ private:
|
||||
uint16_t width;
|
||||
}m_bg0sub;
|
||||
|
||||
|
||||
struct{
|
||||
uint8_t index;
|
||||
uint8_t ctrl;
|
||||
}m_micro_prg;
|
||||
|
||||
|
||||
const address_space_config m_program_space_config;
|
||||
const address_space_config m_data_space_config;
|
||||
required_shared_ptr<uint16_t> m_microprg_ram;
|
||||
|
@ -427,11 +427,13 @@ static MACHINE_CONFIG_START( pcfx, pcfx_state )
|
||||
MCFG_DEVICE_ADD("huc6261", HUC6261, XTAL_21_4772MHz)
|
||||
MCFG_HUC6261_VDC1("huc6270_a")
|
||||
MCFG_HUC6261_VDC2("huc6270_b")
|
||||
MCFG_HUC6261_KING("huc6272")
|
||||
|
||||
MCFG_HUC6272_ADD( "huc6272", XTAL_21_4772MHz )
|
||||
MCFG_HUC6272_IRQ_CHANGED_CB(WRITELINE(pcfx_state, irq13_w))
|
||||
|
||||
MCFG_HUC6271_ADD( "huc6271", XTAL_21_4772MHz )
|
||||
MCFG_HUC6272_RAINBOW("huc6271")
|
||||
|
||||
MCFG_HUC6271_ADD( "huc6271", XTAL_21_4772MHz )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user