summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2014-04-02 13:17:56 +0000
committer Curt Coder <curtcoder@mail.com>2014-04-02 13:17:56 +0000
commit5339b585ac4ab7f639438b7f6855141f3cf3b57e (patch)
treea519ecc5057872424b4034cba6d176b62711aada
parentef89442025262cebe6e3d614601c8a0aac8ee82d (diff)
upd7220: devcb2 and delegates. (nw)
-rw-r--r--src/emu/bus/wangpc/tig.c31
-rw-r--r--src/emu/bus/wangpc/tig.h3
-rw-r--r--src/emu/video/upd7220.c137
-rw-r--r--src/emu/video/upd7220.h79
-rw-r--r--src/mess/drivers/a5105.c41
-rw-r--r--src/mess/drivers/apc.c61
-rw-r--r--src/mess/drivers/compis.c22
-rw-r--r--src/mess/drivers/dmv.c32
-rw-r--r--src/mess/drivers/if800.c21
-rw-r--r--src/mess/drivers/mz3500.c54
-rw-r--r--src/mess/drivers/mz6500.c26
-rw-r--r--src/mess/drivers/pc9801.c128
-rw-r--r--src/mess/drivers/qx10.c50
-rw-r--r--src/mess/drivers/vt240.c22
-rw-r--r--src/mess/includes/compis.h2
-rw-r--r--src/mess/includes/mikromik.h1
-rw-r--r--src/mess/video/mikromik.c22
17 files changed, 319 insertions, 413 deletions
diff --git a/src/emu/bus/wangpc/tig.c b/src/emu/bus/wangpc/tig.c
index 41e83652e84..4c7b27dc0d9 100644
--- a/src/emu/bus/wangpc/tig.c
+++ b/src/emu/bus/wangpc/tig.c
@@ -89,19 +89,10 @@ static ADDRESS_MAP_START( upd7220_0_map, AS_0, 8, wangpc_tig_device )
AM_RANGE(0x4000, 0x7fff) AM_RAM // font memory
ADDRESS_MAP_END
-static UPD7220_DRAW_TEXT_LINE( hgdc_display_text)
+UPD7220_DRAW_TEXT_LINE_MEMBER( wangpc_tig_device::hgdc_draw_text )
{
}
-static UPD7220_INTERFACE( hgdc0_intf )
-{
- NULL,
- hgdc_display_text,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
//-------------------------------------------------
// UPD7220_INTERFACE( hgdc1_intf )
@@ -112,19 +103,10 @@ static ADDRESS_MAP_START( upd7220_1_map, AS_0, 8, wangpc_tig_device )
AM_RANGE(0x0000, 0xffff) AM_RAM // graphics memory
ADDRESS_MAP_END
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( wangpc_tig_device::hgdc_display_pixels )
{
}
-static UPD7220_INTERFACE( hgdc1_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( wangpc_tig )
@@ -140,9 +122,14 @@ static MACHINE_CONFIG_FRAGMENT( wangpc_tig )
MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT("palette")
- MCFG_UPD7220_ADD(UPD7720_0_TAG, XTAL_52_832MHz/28, hgdc0_intf, upd7220_0_map) // was /10?
+ MCFG_DEVICE_ADD(UPD7720_0_TAG, UPD7220, XTAL_52_832MHz/28)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_0_map)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(wangpc_tig_device, hgdc_draw_text)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
- MCFG_UPD7220_ADD(UPD7720_1_TAG, XTAL_52_832MHz/28, hgdc1_intf, upd7220_1_map) // was /16?
+
+ MCFG_DEVICE_ADD(UPD7720_1_TAG, UPD7220, XTAL_52_832MHz/28)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(wangpc_tig_device, hgdc_display_pixels)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
MACHINE_CONFIG_END
diff --git a/src/emu/bus/wangpc/tig.h b/src/emu/bus/wangpc/tig.h
index a484142a7ee..dae01f0a56d 100644
--- a/src/emu/bus/wangpc/tig.h
+++ b/src/emu/bus/wangpc/tig.h
@@ -38,6 +38,9 @@ public:
virtual machine_config_constructor device_mconfig_additions() const;
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
+
protected:
// device-level overrides
virtual void device_start();
diff --git a/src/emu/video/upd7220.c b/src/emu/video/upd7220.c
index 27c630bc381..c6b4b5a5f69 100644
--- a/src/emu/video/upd7220.c
+++ b/src/emu/video/upd7220.c
@@ -182,30 +182,6 @@ const rom_entry *upd7220_device::device_rom_region() const
}
-//-------------------------------------------------
-// device_config_complete - perform any
-// operations now that the configuration is
-// complete
-//-------------------------------------------------
-
-void upd7220_device::device_config_complete()
-{
- // inherit a copy of the static data
- const upd7220_interface *intf = reinterpret_cast<const upd7220_interface *>(static_config());
- if (intf != NULL)
- *static_cast<upd7220_interface *>(this) = *intf;
-
- // or initialize to defaults if none provided
- else
- {
- memset(&m_out_drq_cb, 0, sizeof(m_out_drq_cb));
- memset(&m_out_hsync_cb, 0, sizeof(m_out_hsync_cb));
- memset(&m_out_vsync_cb, 0, sizeof(m_out_vsync_cb));
- memset(&m_out_blank_cb, 0, sizeof(m_out_blank_cb));
- }
-}
-
-
//**************************************************************************
// INLINE HELPERS
@@ -681,43 +657,47 @@ inline void upd7220_device::get_graphics_partition(int index, UINT32 *sad, UINT1
// upd7220_device - constructor
//-------------------------------------------------
-upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : device_t(mconfig, UPD7220, "uPD7220", tag, owner, clock, "upd7220", __FILE__),
- device_memory_interface(mconfig, *this),
- device_video_interface(mconfig, *this),
- m_mask(0),
- m_pitch(0),
- m_ead(0),
- m_dad(0),
- m_lad(0),
- m_ra_addr(0),
- m_sr(UPD7220_SR_FIFO_EMPTY),
- m_cr(0),
- m_param_ptr(0),
- m_fifo_ptr(-1),
- m_fifo_dir(0),
- m_mode(0),
- m_draw_mode(0),
- m_de(0),
- m_m(0),
- m_aw(0),
- m_al(0),
- m_vs(0),
- m_vfp(0),
- m_vbp(0),
- m_hs(0),
- m_hfp(0),
- m_hbp(0),
- m_dc(0),
- m_sc(0),
- m_br(0),
- m_ctop(0),
- m_cbot(0),
- m_lr(0),
- m_disp(0),
- m_gchr(0),
- m_bitmap_mod(0),
- m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, NULL, *ADDRESS_MAP_NAME(upd7220_vram))
+upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, UPD7220, "uPD7220", tag, owner, clock, "upd7220", __FILE__),
+ device_memory_interface(mconfig, *this),
+ device_video_interface(mconfig, *this),
+ m_write_drq(*this),
+ m_write_hsync(*this),
+ m_write_vsync(*this),
+ m_write_blank(*this),
+ m_mask(0),
+ m_pitch(0),
+ m_ead(0),
+ m_dad(0),
+ m_lad(0),
+ m_ra_addr(0),
+ m_sr(UPD7220_SR_FIFO_EMPTY),
+ m_cr(0),
+ m_param_ptr(0),
+ m_fifo_ptr(-1),
+ m_fifo_dir(0),
+ m_mode(0),
+ m_draw_mode(0),
+ m_de(0),
+ m_m(0),
+ m_aw(0),
+ m_al(0),
+ m_vs(0),
+ m_vfp(0),
+ m_vbp(0),
+ m_hs(0),
+ m_hfp(0),
+ m_hbp(0),
+ m_dc(0),
+ m_sc(0),
+ m_br(0),
+ m_ctop(0),
+ m_cbot(0),
+ m_lr(0),
+ m_disp(0),
+ m_gchr(0),
+ m_bitmap_mod(0),
+ m_space_config("videoram", ENDIANNESS_LITTLE, 8, 18, 0, NULL, *ADDRESS_MAP_NAME(upd7220_vram))
{
for (int i = 0; i < 16; i++)
{
@@ -748,17 +728,20 @@ upd7220_device::upd7220_device(const machine_config &mconfig, const char *tag, d
void upd7220_device::device_start()
{
+ // resolve callbacks
+ m_display_cb.bind_relative_to(*owner());
+ m_draw_text_cb.bind_relative_to(*owner());
+
+ m_write_drq.resolve_safe();
+ m_write_hsync.resolve_safe();
+ m_write_vsync.resolve_safe();
+ m_write_blank.resolve_safe();
+
// allocate timers
m_vsync_timer = timer_alloc(TIMER_VSYNC);
m_hsync_timer = timer_alloc(TIMER_HSYNC);
m_blank_timer = timer_alloc(TIMER_BLANK);
- // resolve callbacks
- m_out_drq_func.resolve(m_out_drq_cb, *this);
- m_out_hsync_func.resolve(m_out_hsync_cb, *this);
- m_out_vsync_func.resolve(m_out_vsync_cb, *this);
- m_out_blank_func.resolve(m_out_blank_cb, *this);
-
// register for state saving
save_item(NAME(m_ra));
save_item(NAME(m_sr));
@@ -795,7 +778,7 @@ void upd7220_device::device_start()
void upd7220_device::device_reset()
{
- m_out_drq_func(CLEAR_LINE);
+ m_write_drq(CLEAR_LINE);
}
@@ -817,7 +800,7 @@ void upd7220_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
}
- m_out_hsync_func(param);
+ m_write_hsync(param);
update_hsync_timer(param);
break;
@@ -832,7 +815,7 @@ void upd7220_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_sr &= ~UPD7220_SR_VSYNC_ACTIVE;
}
- m_out_vsync_func(param);
+ m_write_vsync(param);
update_vsync_timer(param);
break;
@@ -847,7 +830,7 @@ void upd7220_device::device_timer(emu_timer &timer, device_timer_id id, int para
m_sr &= ~UPD7220_SR_HBLANK_ACTIVE;
}
- m_out_blank_func(param);
+ m_write_blank(param);
update_blank_timer(param);
break;
@@ -1556,8 +1539,8 @@ void upd7220_device::update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect
{
addr = sad + (y * m_pitch);
- if (m_draw_text_cb)
- m_draw_text_cb(this, bitmap, addr, y, wd, m_pitch, m_lr, m_dc, m_ead);
+ if (!m_draw_text_cb.isnull())
+ m_draw_text_cb(bitmap, addr, y, wd, m_pitch, m_lr, m_dc, m_ead);
}
sy = y + 1;
@@ -1576,7 +1559,7 @@ void upd7220_device::draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y
for (sx = 0; sx < 80; sx++)
{
if((sx << 3) < m_aw * 16 && y < m_al)
- m_display_cb(this, bitmap, y, sx << 3, addr);
+ m_display_cb(bitmap, y, sx << 3, addr);
addr+= wd + 1;
}
@@ -1613,7 +1596,7 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip
Dragon Buster (PC-98xx) contradicts with Xevious with regards of the pitch tho ... */
addr = ((sad << 1) & 0x3ffff) + (y * m_pitch * 2);
- if (m_display_cb)
+ if (!m_display_cb.isnull())
draw_graphics_line(bitmap, addr, y + bsy/((m_pitch == 40)+1), wd);
}
}
@@ -1627,8 +1610,8 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip
{
addr = (sad & 0x3ffff) + ((y / m_lr) * m_pitch);
- if (m_draw_text_cb)
- m_draw_text_cb(this, bitmap, addr, (y + tsy) / m_lr, wd, m_pitch, m_lr, m_dc, m_ead);
+ if (!m_draw_text_cb.isnull())
+ m_draw_text_cb(bitmap, addr, (y + tsy) / m_lr, wd, m_pitch, m_lr, m_dc, m_ead);
}
}
}
diff --git a/src/emu/video/upd7220.h b/src/emu/video/upd7220.h
index 9662f1c87a4..bb7a086542d 100644
--- a/src/emu/video/upd7220.h
+++ b/src/emu/video/upd7220.h
@@ -40,23 +40,30 @@
//**************************************************************************
-// MACROS / CONSTANTS
+// INTERFACE CONFIGURATION MACROS
//**************************************************************************
+#define UPD7220_DISPLAY_PIXELS_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int y, int x, UINT32 address)
+#define UPD7220_DRAW_TEXT_LINE_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)
+#define MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(_class, _method) \
+ upd7220_device::static_set_display_pixels_callback(*device, upd7220_display_pixels_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-//**************************************************************************
-// INTERFACE CONFIGURATION MACROS
-//**************************************************************************
+#define MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(_class, _method) \
+ upd7220_device::static_set_draw_text_callback(*device, upd7220_draw_text_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner)));
-#define MCFG_UPD7220_ADD(_tag, _clock, _config, _map) \
- MCFG_DEVICE_ADD(_tag, UPD7220, _clock) \
- MCFG_DEVICE_CONFIG(_config) \
- MCFG_DEVICE_ADDRESS_MAP(AS_0, _map)
+#define MCFG_UPD7220_DRQ_CALLBACK(_write) \
+ devcb = &upd7220_device::set_drq_wr_callback(*device, DEVCB2_##_write);
-#define UPD7220_INTERFACE(name) \
- const upd7220_interface (name) =
+#define MCFG_UPD7220_HSYNC_CALLBACK(_write) \
+ devcb = &upd7220_device::set_hsync_wr_callback(*device, DEVCB2_##_write);
+
+#define MCFG_UPD7220_VSYNC_CALLBACK(_write) \
+ devcb = &upd7220_device::set_vsync_wr_callback(*device, DEVCB2_##_write);
+
+#define MCFG_UPD7220_BLANK_CALLBACK(_write) \
+ devcb = &upd7220_device::set_blank_wr_callback(*device, DEVCB2_##_write);
@@ -64,37 +71,28 @@
// TYPE DEFINITIONS
//**************************************************************************
-typedef void (*upd7220_display_pixels_func)(device_t *device, bitmap_rgb32 &bitmap, int y, int x, UINT32 address);
-#define UPD7220_DISPLAY_PIXELS(name) void name(device_t *device, bitmap_rgb32 &bitmap, int y, int x, UINT32 address)
-
-typedef void (*upd7220_draw_text_line)(device_t *device, bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr);
-#define UPD7220_DRAW_TEXT_LINE(name) void name(device_t *device, bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)
-
+typedef device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, UINT32 address)> upd7220_display_pixels_delegate;
+typedef device_delegate<void (bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)> upd7220_draw_text_delegate;
-// ======================> upd7220_interface
-
-struct upd7220_interface
-{
- upd7220_display_pixels_func m_display_cb;
- upd7220_draw_text_line m_draw_text_cb;
-
- devcb_write_line m_out_drq_cb;
- devcb_write_line m_out_hsync_cb;
- devcb_write_line m_out_vsync_cb;
- devcb_write_line m_out_blank_cb;
-};
// ======================> upd7220_device
class upd7220_device : public device_t,
public device_memory_interface,
- public device_video_interface,
- public upd7220_interface
+ public device_video_interface
{
public:
// construction/destruction
upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ static void static_set_display_pixels_callback(device_t &device, upd7220_display_pixels_delegate callback) { downcast<upd7220_device &>(device).m_display_cb = callback; }
+ static void static_set_draw_text_callback(device_t &device, upd7220_draw_text_delegate callback) { downcast<upd7220_device &>(device).m_draw_text_cb = callback; }
+
+ template<class _Object> static devcb2_base &set_drq_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_drq.set_callback(object); }
+ template<class _Object> static devcb2_base &set_hsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_hsync.set_callback(object); }
+ template<class _Object> static devcb2_base &set_vsync_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_vsync.set_callback(object); }
+ template<class _Object> static devcb2_base &set_blank_wr_callback(device_t &device, _Object object) { return downcast<upd7220_device &>(device).m_write_blank.set_callback(object); }
+
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
@@ -117,12 +115,14 @@ protected:
virtual void device_start();
virtual void device_reset();
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
- virtual void device_config_complete();
private:
- static const device_timer_id TIMER_VSYNC = 0;
- static const device_timer_id TIMER_HSYNC = 1;
- static const device_timer_id TIMER_BLANK = 2;
+ enum
+ {
+ TIMER_VSYNC,
+ TIMER_HSYNC,
+ TIMER_BLANK
+ };
inline UINT8 readbyte(offs_t address);
inline void writebyte(offs_t address, UINT8 data);
@@ -153,10 +153,13 @@ private:
void draw_graphics_line(bitmap_rgb32 &bitmap, UINT32 addr, int y, int wd);
void update_graphics(bitmap_rgb32 &bitmap, const rectangle &cliprect, int force_bitmap);
- devcb_resolved_write_line m_out_drq_func;
- devcb_resolved_write_line m_out_hsync_func;
- devcb_resolved_write_line m_out_vsync_func;
- devcb_resolved_write_line m_out_blank_func;
+ upd7220_display_pixels_delegate m_display_cb;
+ upd7220_draw_text_delegate m_draw_text_cb;
+
+ devcb2_write_line m_write_drq;
+ devcb2_write_line m_write_hsync;
+ devcb2_write_line m_write_vsync;
+ devcb2_write_line m_write_blank;
UINT16 m_mask; // mask register
UINT8 m_pitch; // number of word addresses in display memory in the horizontal direction
diff --git a/src/mess/drivers/a5105.c b/src/mess/drivers/a5105.c
index 470225f36c5..5be2ccf56d7 100644
--- a/src/mess/drivers/a5105.c
+++ b/src/mess/drivers/a5105.c
@@ -88,18 +88,19 @@ public:
required_device<ram_device> m_ram;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
};
/* TODO */
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels )
{
- a5105_state *state = device->machine().driver_data<a5105_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int xi,gfx;
UINT8 pen;
- gfx = state->m_video_ram[address & 0x1ffff];
+ gfx = m_video_ram[address & 0x1ffff];
for(xi=0;xi<8;xi++)
{
@@ -109,10 +110,9 @@ static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
}
}
-static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
+UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text )
{
- a5105_state *state = device->machine().driver_data<a5105_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int x;
int xi,yi;
int tile,color;
@@ -120,14 +120,14 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
for( x = 0; x < pitch; x++ )
{
- tile = (state->m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff);
- color = (state->m_video_ram[((addr+x)*2+1) & 0x1ffff] & 0x0f);
+ tile = (m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff);
+ color = (m_video_ram[((addr+x)*2+1) & 0x1ffff] & 0x0f);
for( yi = 0; yi < lr; yi++)
{
- tile_data = state->m_char_ram[(tile*8+yi) & 0x7ff];
+ tile_data = m_char_ram[(tile*8+yi) & 0x7ff];
- if(cursor_on && cursor_addr == addr+x && device->machine().first_screen()->frame_number() & 0x10)
+ if(cursor_on && cursor_addr == addr+x && machine().first_screen()->frame_number() & 0x10)
tile_data^=0xff;
for( xi = 0; xi < 8; xi++)
@@ -141,12 +141,12 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
if(yi >= 8) { pen = 0; }
/* TODO: pitch is currently 40, this should actually go in the upd7220 device */
- if(!device->machine().first_screen()->visible_area().contains(res_x*2+0, res_y))
+ if(!machine().first_screen()->visible_area().contains(res_x*2+0, res_y))
continue;
bitmap.pix32(res_y, res_x*2+0) = palette[pen];
- if(!device->machine().first_screen()->visible_area().contains(res_x*2+1, res_y))
+ if(!machine().first_screen()->visible_area().contains(res_x*2+1, res_y))
continue;
bitmap.pix32(res_y, res_x*2+1) = palette[pen];
@@ -539,15 +539,6 @@ void a5105_state::video_start()
m_char_ram = memregion("pcg")->base();
}
-static UPD7220_INTERFACE( hgdc_intf )
-{
- hgdc_display_pixels,
- hgdc_draw_text,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
static ADDRESS_MAP_START( upd7220_map, AS_0, 8, a5105_state)
ADDRESS_MAP_GLOBAL_MASK(0x1ffff)
AM_RANGE(0x00000, 0x1ffff) AM_RAM AM_SHARE("video_ram")
@@ -613,7 +604,11 @@ static MACHINE_CONFIG_START( a5105, a5105_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
/* Devices */
- MCFG_UPD7220_ADD("upd7220", XTAL_15MHz / 16, hgdc_intf, upd7220_map) // unk clock
+ MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_15MHz / 16) // unk clock
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(a5105_state, hgdc_display_pixels)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(a5105_state, hgdc_draw_text)
+
MCFG_Z80CTC_ADD( "z80ctc", XTAL_15MHz / 4, a5105_ctc_intf )
MCFG_Z80PIO_ADD( "z80pio", XTAL_15MHz / 4, a5105_pio_intf )
diff --git a/src/mess/drivers/apc.c b/src/mess/drivers/apc.c
index fe7bce224ba..87e82527877 100644
--- a/src/mess/drivers/apc.c
+++ b/src/mess/drivers/apc.c
@@ -151,6 +151,9 @@ public:
UINT8 m_dma_offset[4];
IRQ_CALLBACK_MEMBER(irq_callback);
+
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
protected:
// driver_device overrides
@@ -179,24 +182,23 @@ UINT32 apc_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, co
}
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( apc_state::hgdc_display_pixels )
{
// ...
}
-static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
+UPD7220_DRAW_TEXT_LINE_MEMBER( apc_state::hgdc_draw_text )
{
- apc_state *state = device->machine().driver_data<apc_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int xi,yi,yi_trans;
int x;
UINT8 char_size;
// UINT8 interlace_on;
-// if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
+// if(m_video_ff[DISPLAY_REG] == 0) //screen is off
// return;
-// interlace_on = state->m_video_reg[2] == 0x10; /* TODO: correct? */
+// interlace_on = m_video_reg[2] == 0x10; /* TODO: correct? */
char_size = 19;
for(x=0;x<pitch;x++)
@@ -208,12 +210,12 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
UINT32 tile_addr;
UINT8 tile_sel;
-// tile_addr = addr+(x*(state->m_video_ff[WIDTH40_REG]+1));
+// tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1));
tile_addr = addr+(x*(1));
- tile = state->m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0x00ff;
- tile_sel = state->m_video_ram_1[(tile_addr*2) & 0x1fff] & 0x00ff;
- attr = (state->m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0x00ff);
+ tile = m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0x00ff;
+ tile_sel = m_video_ram_1[(tile_addr*2) & 0x1fff] & 0x00ff;
+ attr = (m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0x00ff);
u_line = attr & 0x01;
o_line = attr & 0x02;
@@ -233,7 +235,7 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
res_x = (x*8+xi);
res_y = y*lr+yi;
- if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
+ if(!machine().first_screen()->visible_area().contains(res_x, res_y))
continue;
/*
@@ -257,18 +259,18 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
if(yi & 0x10)
tile_data = 0;
else
- tile_data = state->m_aux_pcg[(tile & 0xff)*0x20+yi*2];
+ tile_data = m_aux_pcg[(tile & 0xff)*0x20+yi*2];
}
else
- tile_data = state->m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)];
+ tile_data = m_char_rom[(tile & 0x7f)+((tile & 0x80)<<4)+((yi_trans & 0xf)*0x80)+((yi_trans & 0x10)<<8)];
if(reverse) { tile_data^=0xff; }
if(u_line && yi == lr-1) { tile_data = 0xff; }
if(o_line && yi == 0) { tile_data = 0xff; }
if(v_line) { tile_data|=1; }
- if(blink && device->machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour
+ if(blink && machine().first_screen()->frame_number() & 0x20) { tile_data = 0; } // TODO: rate & correct behaviour
- if(cursor_on && cursor_addr == tile_addr && device->machine().first_screen()->frame_number() & 0x10)
+ if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10)
tile_data^=0xff;
if(yi >= char_size)
@@ -758,26 +760,6 @@ void apc_state::machine_reset()
m_keyb.sig = 0;
}
-
-static UPD7220_INTERFACE( hgdc_1_intf )
-{
- NULL,
- hgdc_draw_text,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
-
-static UPD7220_INTERFACE( hgdc_2_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
static const gfx_layout charset_8x16 =
{
8, 16,
@@ -1000,8 +982,13 @@ static MACHINE_CONFIG_START( apc, apc_state )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", apc)
- MCFG_UPD7220_ADD("upd7220_chr", XTAL_3_579545MHz, hgdc_1_intf, upd7220_1_map) // unk clock
- MCFG_UPD7220_ADD("upd7220_btm", XTAL_3_579545MHz, hgdc_2_intf, upd7220_2_map) // unk clock
+ MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 3579545) // unk clock
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(apc_state, hgdc_draw_text)
+
+ MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 3579545) // unk clock
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(apc_state, hgdc_display_pixels)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(apc_state,apc)
diff --git a/src/mess/drivers/compis.c b/src/mess/drivers/compis.c
index f19bba2b7ed..f588c08b946 100644
--- a/src/mess/drivers/compis.c
+++ b/src/mess/drivers/compis.c
@@ -453,25 +453,15 @@ INPUT_PORTS_END
// UPD7220_INTERFACE( hgdc_intf )
//-------------------------------------------------
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( compis_state::hgdc_display_pixels )
{
- compis_state *state = device->machine().driver_data<compis_state>();
- UINT8 i,gfx = state->m_video_ram[address];
- const pen_t *pen = state->m_palette->pens();
+ UINT8 i,gfx = m_video_ram[address];
+ const pen_t *pen = m_palette->pens();
for(i=0; i<8; i++)
bitmap.pix32(y, x + i) = pen[BIT(gfx, i)];
}
-static UPD7220_INTERFACE( hgdc_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
//-------------------------------------------------
// I80186_INTERFACE( cpu_intf )
@@ -722,8 +712,12 @@ static MACHINE_CONFIG_START( compis, compis_state )
MCFG_SCREEN_SIZE(640, 400)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
- MCFG_UPD7220_ADD("upd7220", XTAL_4_433619MHz/2, hgdc_intf, upd7220_map) //unknown clock
+
+ MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4_433619MHz/2) // unknown clock
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(compis_state, hgdc_display_pixels)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
+
MCFG_PALETTE_ADD_MONOCHROME_GREEN("palette")
// devices
diff --git a/src/mess/drivers/dmv.c b/src/mess/drivers/dmv.c
index 54ecc9787c4..3a12bb7fd51 100644
--- a/src/mess/drivers/dmv.c
+++ b/src/mess/drivers/dmv.c
@@ -56,6 +56,9 @@ public:
required_shared_ptr<UINT8> m_video_ram;
required_device<palette_device> m_palette;
+
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
};
@@ -131,20 +134,19 @@ WRITE8_MEMBER(dmv_state::kb_ctrl_mcu_w)
machine().device<upi41_cpu_device>("kb_ctrl_mcu")->upi41_master_w(space, offset, data);
}
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( dmv_state::hgdc_display_pixels )
{
//TODO
}
-static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
+UPD7220_DRAW_TEXT_LINE_MEMBER( dmv_state::hgdc_draw_text )
{
- dmv_state *state = device->machine().driver_data<dmv_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
- UINT8 * chargen = state->memregion("maincpu")->base() + 0x1000;
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
+ UINT8 * chargen = memregion("maincpu")->base() + 0x1000;
for( int x = 0; x < pitch; x++ )
{
- UINT8 tile = state->m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff;
+ UINT8 tile = m_video_ram[((addr+x)*2) & 0x1ffff] & 0xff;
for( int yi = 0; yi < lr; yi++)
{
@@ -161,7 +163,7 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
res_x = x * 8 + xi;
res_y = y * lr + yi;
- if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
+ if(!machine().first_screen()->visible_area().contains(res_x, res_y))
continue;
if(yi >= 16) { pen = 0; }
@@ -250,16 +252,6 @@ static GFXDECODE_START( dmv )
GFXDECODE_END
-static UPD7220_INTERFACE( hgdc_intf )
-{
- hgdc_display_pixels,
- hgdc_draw_text,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
-
//------------------------------------------------------------------------------------
// I8237_INTERFACE
//------------------------------------------------------------------------------------
@@ -322,7 +314,11 @@ static MACHINE_CONFIG_START( dmv, dmv_state )
MCFG_DEFAULT_LAYOUT(layout_dmv)
// devices
- MCFG_UPD7220_ADD( "upd7220", XTAL_5MHz/2, hgdc_intf, upd7220_map ) // unk clock
+ MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_5MHz/2) // unk clock
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(dmv_state, hgdc_display_pixels)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(dmv_state, hgdc_draw_text)
+
MCFG_I8237_ADD( "dma8237", XTAL_4MHz, dmv_dma8237_config )
MCFG_UPD765A_ADD( "upd765", true, true )
MCFG_UPD765_DRQ_CALLBACK(DEVWRITELINE("dma8237", am9517a_device, dreq3_w))
diff --git a/src/mess/drivers/if800.c b/src/mess/drivers/if800.c
index eaba1bce7bc..3b0a9612b96 100644
--- a/src/mess/drivers/if800.c
+++ b/src/mess/drivers/if800.c
@@ -28,17 +28,17 @@ public:
virtual void machine_reset();
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
};
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( if800_state::hgdc_display_pixels )
{
- if800_state *state = device->machine().driver_data<if800_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int xi,gfx;
UINT8 pen;
- gfx = state->m_video_ram[address];
+ gfx = m_video_ram[address];
for(xi=0;xi<8;xi++)
{
@@ -73,15 +73,6 @@ void if800_state::machine_reset()
{
}
-static UPD7220_INTERFACE( hgdc_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
static ADDRESS_MAP_START( upd7220_map, AS_0, 8, if800_state )
AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram")
ADDRESS_MAP_END
@@ -94,7 +85,9 @@ static MACHINE_CONFIG_START( if800, if800_state )
// MCFG_PIC8259_ADD( "pic8259", if800_pic8259_config )
- MCFG_UPD7220_ADD("upd7220", 8000000/4, hgdc_intf, upd7220_map)
+ MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/4)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(if800_state, hgdc_display_pixels)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mess/drivers/mz3500.c b/src/mess/drivers/mz3500.c
index e53b6848c61..abc7d1423a4 100644
--- a/src/mess/drivers/mz3500.c
+++ b/src/mess/drivers/mz3500.c
@@ -97,6 +97,9 @@ public:
// screen updates
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_PALETTE_INIT(mz3500);
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
+
protected:
// driver_device overrides
virtual void machine_start();
@@ -137,15 +140,14 @@ CRTC regs
(mirror of [5]?)
*/
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( mz3500_state::hgdc_display_pixels )
{
// ...
}
-static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
+UPD7220_DRAW_TEXT_LINE_MEMBER( mz3500_state::hgdc_draw_text )
{
- mz3500_state *state = device->machine().driver_data<mz3500_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int x;
int xi,yi;
int tile;
@@ -156,24 +158,24 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
UINT8 hires;
UINT8 color_mode;
-// popmessage("%02x",state->m_crtc[6]);
+// popmessage("%02x",m_crtc[6]);
- color_mode = state->m_crtc[4] & 1;
- width80 = (state->m_crtc[5] & 2) >> 1;
- hires = (state->m_crtc[6] & 1);
+ color_mode = m_crtc[4] & 1;
+ width80 = (m_crtc[5] & 2) >> 1;
+ hires = (m_crtc[6] & 1);
char_size = (hires) ? 16 : 8;
for( x = 0; x < pitch; x++ )
{
- tile = (state->m_video_ram[((addr+x)*2) & 0x1fff] & 0xff);
- attr = (state->m_video_ram[((addr+x)*2+1) & 0x3ffff] & 0x0f);
+ tile = (m_video_ram[((addr+x)*2) & 0x1fff] & 0xff);
+ attr = (m_video_ram[((addr+x)*2+1) & 0x3ffff] & 0x0f);
//if(hires)
// tile <<= 1;
for( yi = 0; yi < lr; yi++)
{
- tile_data = state->m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)];
+ tile_data = m_char_rom[((tile*16+yi) & 0xfff) | (hires*0x1000)];
for( xi = 0; xi < 8; xi++)
{
@@ -234,26 +236,6 @@ UINT32 mz3500_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap,
return 0;
}
-
-
-static UPD7220_INTERFACE( hgdc_1_intf )
-{
- NULL,
- hgdc_draw_text,
- DEVCB_NULL,
- DEVCB_DEVICE_LINE_MEMBER("upd7220_gfx", upd7220_device, ext_sync_w),
- DEVCB_NULL
-};
-
-static UPD7220_INTERFACE( hgdc_2_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
READ8_MEMBER(mz3500_state::mz3500_ipl_r)
{
return m_ipl_rom[offset];
@@ -852,8 +834,14 @@ static MACHINE_CONFIG_START( mz3500, mz3500_state )
MCFG_FLOPPY_DRIVE_ADD("upd765a:2", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("upd765a:3", mz3500_floppies, "525ssdd", floppy_image_device::default_floppy_formats)
- MCFG_UPD7220_ADD("upd7220_chr", MAIN_CLOCK/5, hgdc_1_intf, upd7220_1_map)
- MCFG_UPD7220_ADD("upd7220_gfx", MAIN_CLOCK/5, hgdc_2_intf, upd7220_2_map)
+ MCFG_DEVICE_ADD("upd7220_chr", UPD7220, MAIN_CLOCK/5)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(mz3500_state, hgdc_draw_text)
+ MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_gfx", upd7220_device, ext_sync_w))
+
+ MCFG_DEVICE_ADD("upd7220_gfx", UPD7220, MAIN_CLOCK/5)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz3500_state, hgdc_display_pixels)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mess/drivers/mz6500.c b/src/mess/drivers/mz6500.c
index edb59103855..9ae8aa7ab66 100644
--- a/src/mess/drivers/mz6500.c
+++ b/src/mess/drivers/mz6500.c
@@ -33,18 +33,18 @@ public:
virtual void video_start();
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
};
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( mz6500_state::hgdc_display_pixels )
{
- mz6500_state *state = device->machine().driver_data<mz6500_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int gfx[3];
UINT8 i,pen;
- gfx[0] = state->m_video_ram[address + 0x00000];
- gfx[1] = state->m_video_ram[address + 0x10000];
- gfx[2] = state->m_video_ram[address + 0x20000];
+ gfx[0] = m_video_ram[address + 0x00000];
+ gfx[1] = m_video_ram[address + 0x10000];
+ gfx[2] = m_video_ram[address + 0x20000];
for(i=0; i<8; i++)
{
@@ -126,15 +126,6 @@ static SLOT_INTERFACE_START( mz6500_floppies )
SLOT_INTERFACE( "525hd", FLOPPY_525_HD )
SLOT_INTERFACE_END
-static UPD7220_INTERFACE( hgdc_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
static ADDRESS_MAP_START( upd7220_map, AS_0, 8, mz6500_state )
AM_RANGE(0x00000, 0x3ffff) AM_RAM AM_SHARE("video_ram")
ADDRESS_MAP_END
@@ -157,7 +148,10 @@ static MACHINE_CONFIG_START( mz6500, mz6500_state )
MCFG_PALETTE_ADD("palette", 8)
/* Devices */
- MCFG_UPD7220_ADD("upd7220", 8000000/6, hgdc_intf, upd7220_map) // unk clock
+ MCFG_DEVICE_ADD("upd7220", UPD7220, 8000000/6) // unk clock
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mz6500_state, hgdc_display_pixels)
+
MCFG_UPD765A_ADD("upd765", true, true)
MCFG_FLOPPY_DRIVE_ADD("upd765:0", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("upd765:1", mz6500_floppies, "525hd", floppy_image_device::default_floppy_formats)
diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c
index c8b9440995f..7b5c101a3a1 100644
--- a/src/mess/drivers/pc9801.c
+++ b/src/mess/drivers/pc9801.c
@@ -683,6 +683,8 @@ public:
DECLARE_WRITE8_MEMBER(pc9821_ext2_video_ff_w);
DECLARE_FLOPPY_FORMATS( floppy_formats );
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
private:
UINT8 m_sdip_read(UINT16 port, UINT8 sdip_offset);
@@ -781,38 +783,37 @@ UINT32 pc9801_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
return 0;
}
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels )
{
- pc9801_state *state = device->machine().driver_data<pc9801_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int xi;
int res_x,res_y;
UINT8 pen;
UINT8 interlace_on;
UINT8 colors16_mode;
- if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
+ if(m_video_ff[DISPLAY_REG] == 0) //screen is off
return;
-// popmessage("%02x %d",state->m_video_ff[INTERLACE_REG],device->machine().first_screen()->visible_area().max_y + 1);
-// interlace_on = ((device->machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0;
- interlace_on = state->m_video_ff[INTERLACE_REG];
- colors16_mode = (state->m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8;
+// popmessage("%02x %d",m_video_ff[INTERLACE_REG],machine().first_screen()->visible_area().max_y + 1);
+// interlace_on = ((machine().first_screen()->visible_area().max_y + 1) >= 400) ? 1 : 0;
+ interlace_on = m_video_ff[INTERLACE_REG];
+ colors16_mode = (m_ex_video_ff[ANALOG_16_MODE]) ? 16 : 8;
- if(state->m_ex_video_ff[ANALOG_256_MODE])
+ if(m_ex_video_ff[ANALOG_256_MODE])
{
for(xi=0;xi<8;xi++)
{
res_x = x + xi;
res_y = y;
- if(!device->machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
+ if(!machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
return;
- pen = state->m_ext_gvram[(address*8+xi)+(state->m_vram_disp*0x40000)];
+ pen = m_ext_gvram[(address*8+xi)+(m_vram_disp*0x40000)];
bitmap.pix32(res_y*2+0, res_x) = palette[pen + 0x20];
- if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
+ if(machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
bitmap.pix32(res_y*2+1, res_x) = palette[pen + 0x20];
}
}
@@ -823,18 +824,18 @@ static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
res_x = x + xi;
res_y = y;
- pen = ((state->m_video_ram_2[(address & 0x7fff) + (0x08000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
- pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x10000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
- pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0x18000) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
- if(state->m_ex_video_ff[ANALOG_16_MODE])
- pen|= ((state->m_video_ram_2[(address & 0x7fff) + (0) + (state->m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 8 : 0;
+ pen = ((m_video_ram_2[(address & 0x7fff) + (0x08000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 1 : 0;
+ pen|= ((m_video_ram_2[(address & 0x7fff) + (0x10000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 2 : 0;
+ pen|= ((m_video_ram_2[(address & 0x7fff) + (0x18000) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 4 : 0;
+ if(m_ex_video_ff[ANALOG_16_MODE])
+ pen|= ((m_video_ram_2[(address & 0x7fff) + (0) + (m_vram_disp*0x20000)] >> (7-xi)) & 1) ? 8 : 0;
if(interlace_on)
{
- if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
+ if(machine().first_screen()->visible_area().contains(res_x, res_y*2+0))
bitmap.pix32(res_y*2+0, res_x) = palette[pen + colors16_mode];
/* TODO: it looks like that PC-98xx can only display even lines ... */
- if(device->machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
+ if(machine().first_screen()->visible_area().contains(res_x, res_y*2+1))
bitmap.pix32(res_y*2+1, res_x) = palette[pen + colors16_mode];
}
else
@@ -843,10 +844,9 @@ static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
}
}
-static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
+UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text )
{
- pc9801_state *state = device->machine().driver_data<pc9801_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int xi,yi;
int x;
UINT8 char_size;
@@ -856,11 +856,11 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
UINT8 kanji_sel;
UINT8 x_step;
- if(state->m_video_ff[DISPLAY_REG] == 0) //screen is off
+ if(m_video_ff[DISPLAY_REG] == 0) //screen is off
return;
-// interlace_on = state->m_video_ff[INTERLACE_REG];
- char_size = state->m_video_ff[FONTSEL_REG] ? 16 : 8;
+// interlace_on = m_video_ff[INTERLACE_REG];
+ char_size = m_video_ff[FONTSEL_REG] ? 16 : 8;
tile = 0;
for(x=0;x<pitch;x+=x_step)
@@ -873,13 +873,13 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
UINT8 knj_tile;
UINT8 gfx_mode;
- tile_addr = addr+(x*(state->m_video_ff[WIDTH40_REG]+1));
+ tile_addr = addr+(x*(m_video_ff[WIDTH40_REG]+1));
kanji_sel = 0;
kanji_lr = 0;
- tile = state->m_video_ram_1[(tile_addr*2) & 0x1fff] & 0xff;
- knj_tile = state->m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0xff;
+ tile = m_video_ram_1[(tile_addr*2) & 0x1fff] & 0xff;
+ knj_tile = m_video_ram_1[(tile_addr*2+1) & 0x1fff] & 0xff;
if(knj_tile)
{
/* Note: bit 7 doesn't really count, if a kanji is enabled then the successive tile is always the second part of it.
@@ -900,14 +900,14 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
else
x_step = 1;
- attr = (state->m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0xff);
+ attr = (m_video_ram_1[(tile_addr*2 & 0x1fff) | 0x2000] & 0xff);
secret = (attr & 1) ^ 1;
blink = attr & 2;
reverse = attr & 4;
u_line = attr & 8;
- v_line = (state->m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10;
- gfx_mode = (state->m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0;
+ v_line = (m_video_ff[ATTRSEL_REG]) ? 0 : attr & 0x10;
+ gfx_mode = (m_video_ff[ATTRSEL_REG]) ? attr & 0x10 : 0;
color = (attr & 0xe0) >> 5;
for(kanji_lr=0;kanji_lr<x_step;kanji_lr++)
@@ -918,10 +918,10 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
{
int res_x,res_y;
- res_x = ((x+kanji_lr)*8+xi) * (state->m_video_ff[WIDTH40_REG]+1);
- res_y = y*lr+yi - (state->m_txt_scroll_reg[3] & 0xf);
+ res_x = ((x+kanji_lr)*8+xi) * (m_video_ff[WIDTH40_REG]+1);
+ res_y = y*lr+yi - (m_txt_scroll_reg[3] & 0xf);
- if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
+ if(!machine().first_screen()->visible_area().contains(res_x, res_y))
continue;
tile_data = 0;
@@ -952,9 +952,9 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
tile_data = ((tile >> gfx_bit) & 1) ? 0xff : 0x00;
}
else if(kanji_sel)
- tile_data = (state->m_kanji_rom[tile*0x20+yi*2+kanji_lr]);
+ tile_data = (m_kanji_rom[tile*0x20+yi*2+kanji_lr]);
else
- tile_data = (state->m_char_rom[tile*char_size+state->m_video_ff[FONTSEL_REG]*0x800+yi]);
+ tile_data = (m_char_rom[tile*char_size+m_video_ff[FONTSEL_REG]*0x800+yi]);
}
if(reverse) { tile_data^=0xff; }
@@ -962,10 +962,10 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
if(v_line) { tile_data|=8; }
/* TODO: proper blink rate for these two */
- if(cursor_on && cursor_addr == tile_addr && device->machine().first_screen()->frame_number() & 0x10)
+ if(cursor_on && cursor_addr == tile_addr && machine().first_screen()->frame_number() & 0x10)
tile_data^=0xff;
- if(blink && device->machine().first_screen()->frame_number() & 0x10)
+ if(blink && machine().first_screen()->frame_number() & 0x10)
tile_data^=0xff;
if(yi >= char_size)
@@ -976,9 +976,9 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
if(pen != -1)
bitmap.pix32(res_y, res_x) = palette[pen];
- if(state->m_video_ff[WIDTH40_REG])
+ if(m_video_ff[WIDTH40_REG])
{
- if(!device->machine().first_screen()->visible_area().contains(res_x+1, res_y))
+ if(!machine().first_screen()->visible_area().contains(res_x+1, res_y))
continue;
if(pen != -1)
@@ -990,24 +990,6 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
}
}
-static UPD7220_INTERFACE( hgdc_1_intf )
-{
- NULL,
- hgdc_draw_text,
- DEVCB_NULL,
- DEVCB_DEVICE_LINE_MEMBER("upd7220_btm", upd7220_device, ext_sync_w),
- DEVCB_NULL
-};
-
-static UPD7220_INTERFACE( hgdc_2_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
#if 0
READ8_MEMBER(pc9801_state::pc9801_xx_r)
@@ -3672,8 +3654,14 @@ static MACHINE_CONFIG_START( pc9801, pc9801_state )
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
- MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
- MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
+ MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
+ MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))
+
+ MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
MCFG_PALETTE_ADD("palette", 16)
MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
@@ -3744,8 +3732,14 @@ static MACHINE_CONFIG_START( pc9801rs, pc9801_state )
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
- MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
- MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
+ MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
+ MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))
+
+ MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
MCFG_PALETTE_ADD("palette", 16+16)
MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
@@ -3830,8 +3824,14 @@ static MACHINE_CONFIG_START( pc9821, pc9801_state )
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
- MCFG_UPD7220_ADD("upd7220_chr", 5000000/2, hgdc_1_intf, upd7220_1_map)
- MCFG_UPD7220_ADD("upd7220_btm", 5000000/2, hgdc_2_intf, upd7220_2_map)
+ MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 5000000/2)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_1_map)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(pc9801_state, hgdc_draw_text)
+ MCFG_UPD7220_VSYNC_CALLBACK(DEVWRITELINE("upd7220_btm", upd7220_device, ext_sync_w))
+
+ MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 5000000/2)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_2_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(pc9801_state, hgdc_display_pixels)
MCFG_PALETTE_ADD("palette", 16+16+256)
MCFG_PALETTE_INIT_OWNER(pc9801_state,pc9801)
diff --git a/src/mess/drivers/qx10.c b/src/mess/drivers/qx10.c
index aada213fb8f..2ea4f686424 100644
--- a/src/mess/drivers/qx10.c
+++ b/src/mess/drivers/qx10.c
@@ -148,24 +148,25 @@ public:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
required_device<palette_device> m_palette;
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
};
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( qx10_state::hgdc_display_pixels )
{
- qx10_state *state = device->machine().driver_data<qx10_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int xi,gfx[3];
UINT8 pen;
- if(state->m_color_mode)
+ if(m_color_mode)
{
- gfx[0] = state->m_video_ram[(address) + 0x00000];
- gfx[1] = state->m_video_ram[(address) + 0x20000];
- gfx[2] = state->m_video_ram[(address) + 0x40000];
+ gfx[0] = m_video_ram[(address) + 0x00000];
+ gfx[1] = m_video_ram[(address) + 0x20000];
+ gfx[2] = m_video_ram[(address) + 0x40000];
}
else
{
- gfx[0] = state->m_video_ram[address];
+ gfx[0] = m_video_ram[address];
gfx[1] = 0;
gfx[2] = 0;
}
@@ -180,10 +181,9 @@ static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
}
}
-static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
+UPD7220_DRAW_TEXT_LINE_MEMBER( qx10_state::hgdc_draw_text )
{
- qx10_state *state = device->machine().driver_data<qx10_state>();
- const rgb_t *palette = state->m_palette->palette()->entry_list_raw();
+ const rgb_t *palette = m_palette->palette()->entry_list_raw();
int x;
int xi,yi;
int tile;
@@ -194,14 +194,14 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
for( x = 0; x < pitch; x++ )
{
- tile = state->m_video_ram[(addr+x)*2];
- attr = state->m_video_ram[(addr+x)*2+1];
+ tile = m_video_ram[(addr+x)*2];
+ attr = m_video_ram[(addr+x)*2+1];
- color = (state->m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */
+ color = (m_color_mode) ? 1 : (attr & 4) ? 2 : 1; /* TODO: color mode */
for( yi = 0; yi < lr; yi++)
{
- tile_data = (state->m_char_rom[tile*16+yi]);
+ tile_data = (m_char_rom[tile*16+yi]);
if(attr & 8)
tile_data^=0xff;
@@ -209,7 +209,7 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
if(cursor_on && cursor_addr == addr+x) //TODO
tile_data^=0xff;
- if(attr & 0x80 && device->machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval
+ if(attr & 0x80 && machine().first_screen()->frame_number() & 0x10) //TODO: check for blinking interval
tile_data=0;
for( xi = 0; xi < 8; xi++)
@@ -219,7 +219,7 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
res_x = x * 8 + xi;
res_y = y * lr + yi;
- if(!device->machine().first_screen()->visible_area().contains(res_x, res_y))
+ if(!machine().first_screen()->visible_area().contains(res_x, res_y))
continue;
if(yi >= 16)
@@ -766,15 +766,6 @@ void qx10_state::video_start()
m_char_rom = memregion("chargen")->base();
}
-static UPD7220_INTERFACE( hgdc_intf )
-{
- hgdc_display_pixels,
- hgdc_draw_text,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
PALETTE_INIT_MEMBER(qx10_state, qx10)
{
// ...
@@ -858,8 +849,13 @@ static MACHINE_CONFIG_START( qx10, qx10_state )
MCFG_I8255_ADD("i8255", qx10_i8255_interface)
MCFG_I8237_ADD("8237dma_1", MAIN_CLK/4, qx10_dma8237_1_interface)
MCFG_I8237_ADD("8237dma_2", MAIN_CLK/4, qx10_dma8237_2_interface)
- MCFG_UPD7220_ADD("upd7220", MAIN_CLK/6, hgdc_intf, upd7220_map) // unk clock
+
+ MCFG_DEVICE_ADD("upd7220", UPD7220, MAIN_CLK/6) // unk clock
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(qx10_state, hgdc_display_pixels)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(qx10_state, hgdc_draw_text)
MCFG_VIDEO_SET_SCREEN("screen")
+
MCFG_MC146818_ADD( "rtc", XTAL_32_768kHz )
MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic8259_slave", pic8259_device, ir2_w))
MCFG_UPD765A_ADD("upd765", true, true)
diff --git a/src/mess/drivers/vt240.c b/src/mess/drivers/vt240.c
index f5e3092ceb8..da79125aa79 100644
--- a/src/mess/drivers/vt240.c
+++ b/src/mess/drivers/vt240.c
@@ -30,8 +30,7 @@ public:
vt240_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_hgdc(*this, "upd7220")
- ,
+ m_hgdc(*this, "upd7220"),
m_video_ram(*this, "video_ram"){ }
required_device<cpu_device> m_maincpu;
@@ -48,12 +47,12 @@ public:
DECLARE_DRIVER_INIT(vt240);
virtual void machine_reset();
INTERRUPT_GEN_MEMBER(vt240_irq);
+ UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
};
/* TODO */
-static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
+UPD7220_DRAW_TEXT_LINE_MEMBER( vt240_state::hgdc_draw_text )
{
- //vt240_state *state = device->machine().driver_data<a5105_state>();
//int x;
//int xi,yi;
//int tile,color;
@@ -67,7 +66,7 @@ static UPD7220_DRAW_TEXT_LINE( hgdc_draw_text )
for( yi = 0; yi < lr; yi++)
{
- tile_data = state->m_char_rom[(tile*8+yi) & 0x7ff];
+ tile_data = m_char_rom[(tile*8+yi) & 0x7ff];
if(cursor_on && cursor_addr == addr+x) //TODO
tile_data^=0xff;
@@ -131,15 +130,6 @@ void vt240_state::machine_reset()
{
}
-static UPD7220_INTERFACE( hgdc_intf )
-{
- NULL,
- hgdc_draw_text,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
INTERRUPT_GEN_MEMBER(vt240_state::vt240_irq)
{
//device.execute().set_input_line(I8085_RST65_LINE, ASSERT_LINE);
@@ -179,7 +169,9 @@ static MACHINE_CONFIG_START( vt240, vt240_state )
MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", vt240)
- MCFG_UPD7220_ADD("upd7220", XTAL_4MHz / 4, hgdc_intf, upd7220_map) //unknown clock
+ MCFG_DEVICE_ADD("upd7220", UPD7220, XTAL_4MHz / 4)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, upd7220_map)
+ MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(vt240_state, hgdc_draw_text)
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mess/includes/compis.h b/src/mess/includes/compis.h
index 46e42737712..a933c48526b 100644
--- a/src/mess/includes/compis.h
+++ b/src/mess/includes/compis.h
@@ -125,6 +125,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(write_centronics_select);
int m_tmr0;
+
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
};
diff --git a/src/mess/includes/mikromik.h b/src/mess/includes/mikromik.h
index ad28a7447e5..6da89ca87ee 100644
--- a/src/mess/includes/mikromik.h
+++ b/src/mess/includes/mikromik.h
@@ -125,6 +125,7 @@ public:
int m_fdc_tc;
DECLARE_FLOPPY_FORMATS( floppy_formats );
+ UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
};
diff --git a/src/mess/video/mikromik.c b/src/mess/video/mikromik.c
index b67dcb46ff8..d2f4fe1a700 100644
--- a/src/mess/video/mikromik.c
+++ b/src/mess/video/mikromik.c
@@ -50,27 +50,16 @@ ADDRESS_MAP_END
// UPD7220_INTERFACE( hgdc_intf )
//-------------------------------------------------
-static UPD7220_DISPLAY_PIXELS( hgdc_display_pixels )
+UPD7220_DISPLAY_PIXELS_MEMBER( mm1_state::hgdc_display_pixels )
{
- mm1_state *state = device->machine().driver_data<mm1_state>();
-
- UINT8 data = state->m_video_ram[address];
+ UINT8 data = m_video_ram[address];
for (int i = 0; i < 8; i++)
{
- if (BIT(data, 7-i)) bitmap.pix32(y, x + i) = state->m_palette->pen(1);
+ if (BIT(data, 7 - i)) bitmap.pix32(y, x + i) = m_palette->pen(1);
}
}
-static UPD7220_INTERFACE( hgdc_intf )
-{
- hgdc_display_pixels,
- NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL
-};
-
UINT32 mm1_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
@@ -127,6 +116,9 @@ MACHINE_CONFIG_FRAGMENT( mm1m6_video )
MCFG_I8275_ADD(I8275_TAG, XTAL_18_720MHz/8, 8, crtc_display_pixels, DEVWRITELINE(I8237_TAG, am9517a_device, dreq0_w))
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
- MCFG_UPD7220_ADD(UPD7220_TAG, XTAL_18_720MHz/8, hgdc_intf, mm1_upd7220_map)
+
+ MCFG_DEVICE_ADD(UPD7220_TAG, UPD7220, XTAL_18_720MHz/8)
+ MCFG_DEVICE_ADDRESS_MAP(AS_0, mm1_upd7220_map)
+ MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(mm1_state, hgdc_display_pixels)
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)
MACHINE_CONFIG_END